[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fix for HISTCMD when HISTFILE is defined, but HISTSIZE is not
From: |
Geoff Odhner |
Subject: |
Fix for HISTCMD when HISTFILE is defined, but HISTSIZE is not |
Date: |
Thu, 29 Sep 2005 14:26:57 -0400 |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/home/geoff/i686/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -I. -I.. -I../include -I../lib -g -O2
uname output: Linux monster 2.6.9-11.ELsmp #1 SMP Fri May 20 18:26:27 EDT 2005
i686 i686 i386 GNU/Linux
Machine Type: i686-pc-linux-gnu
Bash Version: 3.0
Patch Level: 16
Release Status: release
Description:
Unsetting HISTSIZE allows an unlimited number of entries in the
history, but it unfortunately causes $HISTCMD to evaluate as 1.
This should only happen if HISTFILE is unset.
Repeat-By:
execute the following two command lines:
% unset HISTSIZE
% echo HISTCMD=$HISTCMD
HISTCMD=1
%
Fix:
The following patch corrects the problem, making HISTCMD
available whenever there is a history file:
======================================================================
diff -Naur bash-3.0/bashhist.c bash-3.0-fixed/bashhist.c
--- bash-3.0/bashhist.c 2004-03-22 08:27:59.000000000 -0500
+++ bash-3.0-fixed/bashhist.c 2005-09-29 09:53:19.903722088 -0400
@@ -706,7 +706,7 @@
history_number ()
{
using_history ();
- return (get_string_value ("HISTSIZE") ? history_base + where_history () : 1);
+ return (get_string_value ("HISTFILE") ? history_base + where_history () : 1);
}
static int
======================================================================