cling icon indicating copy to clipboard operation
cling copied to clipboard

`.cling_history` shouldn't grow infinitely

Open Axel-Naumann opened this issue 3 years ago • 8 comments

Explain what you would like to see improved

.cling_history currently grows without limits, we have some that are 144M.

Optional: share how it could be improved

We probably want both:

  1. drop the oldest entries, such that it remains < 1M or so.
  2. prevent the cling test suite from adding to the history - that's useless.

Axel-Naumann avatar Nov 14 '22 11:11 Axel-Naumann

Maybe follow what bash does with .bash_history? There are two env vars -- HISTSIZE and HISTFILESIZE -- which control how many commands are stored in the file and max file size.

By default HISTSIZE is 500 and HISTFILESIZE is 0.

cling can have two variables -- CLING_HISTSIZE and CLING_HISTFILESIZE -- that are initialized to the same values (500 and 0) by default and allow overriding them.

dimitry-ishenko avatar May 10 '23 15:05 dimitry-ishenko

As regards to the 2nd point, I remember seeing some commits in @vgvassilev's repo that allowed one to specify custom history file. So, the test suite shoud set it to some file using eg mktemp and not pollute the default one.

dimitry-ishenko avatar May 10 '23 16:05 dimitry-ishenko

It looks like point 2 has already been implemented in https://github.com/root-project/cling/commit/90a763946158f4a00acde84bed97866dd5d8e6f4. Just need to get the test suite to specify a temp history file.

dimitry-ishenko avatar May 10 '23 16:05 dimitry-ishenko

And it seem CLING_HISTSIZE has also been implemented in https://github.com/root-project/cling/commit/392d5365d5af7cf3c8296809e4537b757ccbd7e3. It just needs to default to a sane value.

dimitry-ishenko avatar May 10 '23 16:05 dimitry-ishenko

@Axel-Naumann are you still interested in this issue? If so, let me know and I can take a stab at it. Otherwise, I'd hate to do something that will then rot in a neglected PR forevermore.

dimitry-ishenko avatar May 12 '23 03:05 dimitry-ishenko

I'm totally interested - I just have very little time slices for this. I'd be amazing if you proposed something! Setting a default, non-infinity value as the upper limit seems the way to go?

Axel-Naumann avatar May 12 '23 04:05 Axel-Naumann

@Axel-Naumann @dimitry-ishenko Is there any progress in this issue? If not, I want to try it.

richen666 avatar May 05 '24 00:05 richen666

@richen666 sorry, no progress from me, I've been busy with other things.

dimitry-ishenko avatar May 05 '24 14:05 dimitry-ishenko