Bug 391537 - bash_history flooded by "cd foo/foo" and "clear" commands
Summary: bash_history flooded by "cd foo/foo" and "clear" commands
Status: RESOLVED FIXED
Alias: None
Product: kile
Classification: Applications
Component: general (show other bugs)
Version: 2.9.91
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Michel Ludwig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-07 19:54 UTC by Benjamin Hennion
Modified: 2022-06-27 23:36 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Hennion 2018-03-07 19:54:34 UTC
Kile writes

cd <working dir>
clear

in .bash_history every time the live preview is compiled after saving, if the live preview behaviour is set to "compile after saving".

Note that if the live preview is set to compile whenever changes have been made, it only writes the above two lines at launch (and not at every compilation of the preview).

This certainly is related to https://bugs.kde.org/show_bug.cgi?id=265165, which has been closed for years.

Step to reproduce:
1- Set live preview to compile every time you save
2- Open a file, modify it and save it (so that the live preview is updated). 
3- Close Kile and look at .bash_history.
Comment 1 Paul Péringuey 2020-05-21 11:13:18 UTC
I'm guessing the problem still comes from the built in konsole as typing history -c in this one prevent the lines to be added to bash_history.

I'd suggested to replace "clear" by "clear && history -d -1 && history -d -1".
Comment 2 Nicolas Fella 2022-06-27 23:36:59 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 453935

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

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