This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix PR gdb/16999
- From: Pedro Alves <palves at redhat dot com>
- To: Patrick Palka <patrick at parcs dot ath dot cx>, Mark Kettenis <mark dot kettenis at xs4all dot nl>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 14 May 2015 10:16:26 +0100
- Subject: Re: [PATCH] Fix PR gdb/16999
- Authentication-results: sourceware.org; auth=none
- References: <1431555450-15493-1-git-send-email-patrick at parcs dot ath dot cx> <201505132224 dot t4DMOLg0002690 at glazunov dot sibelius dot xs4all dot nl> <CA+C-WL_81cSgvUPes8d18z0Ov_gEUcn=f2dfsDb6geKmd4uUmg at mail dot gmail dot com>
On 05/13/2015 11:38 PM, Patrick Palka wrote:
> On Wed, May 13, 2015 at 6:24 PM, Mark Kettenis <mark.kettenis@xs4all.nl> wrote:
>>>
>>> When GDB reads a nonsensical value for the HISTSIZE environment variable
>>> variable, i.e. one that is non-numeric or negative, GDB then sets its
>>> history size to 0. This behavior is contrary to that of bash, which
>>> defaults the history size to unlimited in such cases.
>>>
>>> This patch makes the behavior of invalid HISTSIZE match that of bash.
>>> When we encounter an invalid HISTSIZE we now set the history size to
>>> unlimited instead of 0.
...
> I personally don't like GDB's behavior because 1) it's not consistent
> with bash and 2) it's unforgiving: a mere typo when setting HISTSIZE
> will truncate the entire history file at exit.
I agree. Users can well set HISTSIZE to -1 in their ~/.bashrc to affect
bash's history, and then it's very annoying that GDB ends up with no
history... As we're reusing this environment variable from bash, I
think the right thing to do is follow whatever bash does.
(BTW, like we have GDBHISTFILE vs bash's HISTFILE, it may be
good to have a GDBHISTSIZE to override HISTSIZE without affecting
bash.)
Thanks,
Pedro Alves