Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line history can grow exponentially #958

Closed
ChrisJefferson opened this issue Nov 24, 2016 · 4 comments
Closed

Command line history can grow exponentially #958

ChrisJefferson opened this issue Nov 24, 2016 · 4 comments

Comments

@ChrisJefferson
Copy link
Contributor

I would like, preferably by default, to change ReadCommandLineHistory to remove duplicated lines, keeping the most recent occurrence of each statement.

At the moment calling ReadCommandLineHistory repeatidly causes the history file to grow without bound, as the old information is concatenated onto the existing history. There is even a comment about this:

For very long ⪆ sessions or if SaveCommandLineHistory and ReadCommandLineHistory are used repeatedly it can be sensible to restrict the number of saved lines

The only possible problem is, are some people relying on their command line history to contain exactly everything they ever typed, in the order it was typed in?

@olexandr-konovalov
Copy link
Member

olexandr-konovalov commented Nov 25, 2016

FYI, from the old Redmine issue tracker:

Issue 472 has been reported by Volker Braun on 14/02/2014.

Due to the CommandLineHistory feature you leak a bag for every command 
line that you send. This is an issue whenever you drive gap programmatically, 
e.g. xgap, Sage, and probably a number of research codes.

I would recommend that the HistoryMaxLines user preference default to 
a finite value, say, 1000. 

@olexandr-konovalov
Copy link
Member

@ChrisJefferson moreover, even the test describing user preferences says "If this (i.e. saving history) is enabled it is suggested to set HistoryMaxLines to some finite value". I have submitted PR #960 in which I have changed the default from infinity to 1000. Hope that there will be no objections to do this in GAP 4.9 since this is configurable user preference after all.

I think removing duplicates is too tedious. It is not possible to track reliably dependencies between different lines, and the result may no longer be consistent, so using it with SaveCommandLineHistory and ReadCommandLineHistory will not work as described. So yes, answering your question, I think that people are indeed "relying on their command line history to contain exactly everything they ever typed, in the order it was typed in". On the other hand, I don't think that people rely on an infinitely long history, and even don't expect it to be infinitely long basing on their experience with UNIX shell where it is limited by default.

@olexandr-konovalov
Copy link
Member

@ChrisJefferson I've suggested alternative in #960 - please have a look.

@olexandr-konovalov
Copy link
Member

Resolved - the default length of command line history was set to 1000 in #960.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants