This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR gdb/16999


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.
>
> The GDB behaviour makes more sense to me especially in light of:
>
>> -       /* Prefer ending up with no history rather than overflowing
>> -          readline's history interface, which uses signed 'int'
>> -          everywhere.  */

We won't overflow readline's history interface with or without the
patch.  The setting of our history size to -1 instructs
set_readline_history_size() to call unstifle_history() instead of
stifle_history(size).

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.

Another possibility is to not touch the history size at all when
HISTSIZE is invalid.  That makes the most sense to me but then the
inconsistency with bash still remains.  Dunno what's better..


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]