This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/2] Read $GDBHISTSIZE instead of $HISTSIZE
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Cc: Patrick Palka <patrick at parcs dot ath dot cx>
- Date: Wed, 17 Jun 2015 14:19:12 -0400
- Subject: Re: [PATCH 1/2] Read $GDBHISTSIZE instead of $HISTSIZE
- Authentication-results: sourceware.org; auth=none
- References: <1432293831-23599-1-git-send-email-patrick at parcs dot ath dot cx>
On Fri, May 22, 2015 at 7:23 AM, Patrick Palka <patrick@parcs.ath.cx> wrote:
> The HISTSIZE environment variable is generally expected to be read by
> shells, not by applications. Some distros for example globally export
> HISTSIZE in /etc/profile -- with the intention that it only affects
> shells -- and by doing so it renders useless GDB's own mechanism for
> setting the history size via .gdbinit. Also, annoyances may arise when
> HISTSIZE is not interpreted the same way by the shell and by GDB, e.g.
> PR gdb/16999. That can always be fixed on a shell-by-shell basis but it
> may be impossible to be consistent with the behavior of all shells at
> once. Finally it just makes sense to not confound shell environment
> variables with application environment variables.
>
> gdb/ChangeLog:
>
> * NEWS: Add entry.
> * top.c (init_history): Read from GDBHISTSIZE instead of
> HISTSIZE.
> (init_main): Refer to GDBHISTSIZE instead of HISTSIZE.
>
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Command History): Replace occurrences of HISTSIZE
> with GDBHISTSIZE.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.base/gdbinit-history.exp: Replace occurrences of HISTSIZE
> with GDBHISTSIZE.
> * gdb.base/readline.exp: Likewis.
Committed this change (without the part that explains in the manual
why we don't use HISTSIZE). Eli, what do you think about the
following addendum to the manual?
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9889b69..c1b11f4 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22644,6 +22644,15 @@ to 256 if this variable is not set.
Non-numeric values of @env{GDBHISTSIZE}
are ignored. If @var{size} is @code{unlimited} or if @env{GDBHISTSIZE} is a
negative number, the number of commands @value{GDBN} keeps in the history list
is unlimited.
+
+Note: In @value{GDBN} version 7.8 and earlier, the @env{HISTSIZE} environment
+variable was read instead of the @env{GDBHISTSIZE} environment variable.
+However, reading @env{HISTSIZE} was problematic since this environment variable
+is usually set with the intention to be read only by the user's shell, and
+differences in interpretation of this environment variable may exist between
+@value{GDBN} and the prevailing shell. So since @value{GDBN} version 7.9 the
+dedicated @env{GDBHISTSIZE} environment variable is instead read for the same
+purpose.
@end table
History expansion assigns special meaning to the character @kbd{!}.