root-project / cling

The cling C++ interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`.cling_history` shouldn't grow infinitely

Axel-Naumann opened this issue · 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.
commented

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.

commented

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.

commented

It looks like point 2 has already been implemented in 90a7639. Just need to get the test suite to specify a temp history file.

commented

And it seem CLING_HISTSIZE has also been implemented in 392d536. It just needs to default to a sane value.

commented

@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.

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 @dimitry-ishenko
Is there any progress in this issue? If not, I want to try it.

commented

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