public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Patrick Palka <patrick@parcs.ath.cx>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix PR gdb/16999
Date: Wed, 13 May 2015 22:38:00 -0000	[thread overview]
Message-ID: <CA+C-WL_81cSgvUPes8d18z0Ov_gEUcn=f2dfsDb6geKmd4uUmg@mail.gmail.com> (raw)
In-Reply-To: <201505132224.t4DMOLg0002690@glazunov.sibelius.xs4all.nl>

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

  reply	other threads:[~2015-05-13 22:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 22:17 Patrick Palka
2015-05-13 22:24 ` Mark Kettenis
2015-05-13 22:38   ` Patrick Palka [this message]
2015-05-14  9:16     ` Pedro Alves
2015-05-14 10:16 ` Pedro Alves
2015-05-14 12:06   ` Patrick Palka
2015-05-15 10:42     ` Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+C-WL_81cSgvUPes8d18z0Ov_gEUcn=f2dfsDb6geKmd4uUmg@mail.gmail.com' \
    --to=patrick@parcs.ath.cx \
    --cc=gdb-patches@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).