Bug 453935

Summary: Inbuilt konsole always write to bash history
Product: [Applications] kile Reporter: Paul PĂ©ringuey <paul.peringuey>
Component: user interfaceAssignee: Michel Ludwig <michel.ludwig>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 2.9.93   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Paul PĂ©ringuey 2022-05-17 12:44:11 UTC
SUMMARY
When opening a tex file the inbuilt konsole send a cd and clear command which appear in bash_history.

STEPS TO REPRODUCE
1. Open tex file in kile.
2. Close it.
3. Open bash_history

OBSERVED RESULT
Two new entries in bash_history.

EXPECTED RESULT
No new entry.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: latest archlinux
(available in About System)
KDE Plasma Version: latest
KDE Frameworks Version: latest
Qt Version: latest

ADDITIONAL INFORMATION
It can be solve by adding in src/widgets/konsolewidget.cpp lines 134 and 135 a space at the beginning of the line, as does dolphin to prevent writing to bash_history if the option "ignorespace" is set in bashrc. These lines would then be

        m_term->sendInput(" cd " + KShell::quoteArg(directory) + '\n');
        m_term->sendInput(" clear\n");
Comment 1 Nicolas Fella 2022-06-27 23:37:07 UTC
Git commit cef2d4888250581420a7909bad5644a9c3c8dedb by Nicolas Fella, on behalf of Alessio Bonfiglio.
Committed on 27/06/2022 at 23:36.
Pushed by nicolasfella into branch 'master'.

Add white space before console commands in order to avoid save them into bash history

This avoids saving the `cd` and `clear` commands into the bash history if `ignorespace` is set in bashrc

Dolphin and Kate do the same in their Konsole integrations
Related: bug 391537

M  +2    -2    src/widgets/konsolewidget.cpp

https://invent.kde.org/office/kile/commit/cef2d4888250581420a7909bad5644a9c3c8dedb