bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Failed bash history search reverts command line to initial input not las


From: llattanzi+bash
Subject: Failed bash history search reverts command line to initial input not last
Date: Tue, 06 Jul 2004 10:38:54 -0700 (PDT)

Configuration Information [Automatically generated, do not change]:
Machine: powerpc
OS: darwin8.0
Compiler: gcc
Compilation CFLAGS: -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe -DPROGRAM='bash' -DCONF_HOSTTYPE='powerpc' -DCONF_OSTYPE='darwin8.0' -DCONF_MACHTYPE='powerpc-apple-darwin8.0' -DCONF_VENDOR='apple' -DSHELL -DHAVE_CONFIG_H -DMACOSX -I. -I/SourceCache/bash/bash-30/bash -I/SourceCache/bash/bash-30/bash/include -I/SourceCache/bash/bash-30/bash/lib -arch i386 -arch ppc -g -Os -pipe -no-cpp-precomp -arch i386 -arch ppc -pipe uname output: Darwin stderr.apple.com 8.0.0b1 Darwin Kernel Version 8.0.0b1: Mon Jun 21 20:09:53 PDT 2004; root:xnu/xnu-634.obj~2/RELEASE_PPC Power Macintosh powerpc
Machine Type: powerpc-apple-darwin8.0

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
Bash only saves the initial command line not the version that was in place
        at the time of the history search

Repeat-By:
        Put some commands in history
        set -o vi
printf "Version 1.0\n"<ESC> <n> k # Get back nth line; then search for something that isn't in history
                              / meaning_of_life
        After the failure you have Version 1.0 instead of the nth history line

Fix:
Index: bash/lib/readline/misc.c
===================================================================
RCS file: /cvs/root/bash/bash/lib/readline/misc.c,v
retrieving revision 1.1.1.1
diff -u -d -b -w -r1.1.1.1 misc.c
--- misc.c      2003/04/05 08:00:33     1.1.1.1
+++ misc.c      2004/07/06 17:33:36
@@ -274,6 +274,12 @@
       _rl_saved_line_for_history->line = savestring (rl_line_buffer);
       _rl_saved_line_for_history->data = (char *)rl_undo_list;
     }
+  else if (!STREQ(rl_line_buffer, _rl_saved_line_for_history->line))
+    { /* resave */
+      free(_rl_saved_line_for_history->line);
+      _rl_saved_line_for_history->line = savestring (rl_line_buffer);
+      _rl_saved_line_for_history->data = (char *)rl_undo_list;
+    }
   return 0;
 }






reply via email to

[Prev in Thread] Current Thread [Next in Thread]