Re: [PATCH] Don't truncate the history file when history size is unlimited

Pedro Alves
2015-06-17T13:14:43Z

On 06/16/2015 04:00 PM, Patrick Palka wrote:

> By the way, what do you think about unsetting
> HOME/HISTSIZE/GDBHISTFILE somewhere higher up in the testsuite
> infrastructure? It would be nice if individual tests did not have to
> worry about such environment variables being leaked from userspace.

On first blush, that sounds like a good idea. Though I wonder
whether that could have unintended consequences. We won't know
until we try, I guess.

Does dejagnu need HOME set? Does Python/Scheme?

Unsetting the GDB-specific GDBHISTSIZE/GDBHISTFILE vars sounds
like a no brainer.

For HISTSIZE, should we audit tests that might start an interactive
shell (e.g., "(gdb) shell") and result in truncating the history file?
Guess better would be to set HISTSIZE="" and HISTFILE=/dev/null
or something like that so shells we start don't have a chance of
mucking with the user's history files?

Urgh, yes, we already have that issue today:

$ make check RUNTESTFLAGS="gdb.base/batch-preserve-term-settings.exp"
$ tail -n 5 ~/.bash_history
stty || echo "not found"
/home/pedro/gdb/mygit/build/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory /home/pedro/gdb/mygit/build/gdb/testsuite/../data-directory -batch -ex "set height unlimited" -ex "start" --args "/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/batch-preserve-term-settings"
echo test_echo
stty || echo "not found"
exit

Whoops...

Thanks,
Pedro Alves