7 Bug-Reported-by: <piuma@piumalab.org>
8 Bug-Reference-ID: <4DAAC0DB.7060606@piumalab.org>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html
13 Under certain circumstances, running `fc -l' two times in succession with a
14 relative history offset at the end of the history will result in an incorrect
15 calculation of the last history entry and a seg fault.
17 Patch (apply with `patch -p0'):
19 *** ../bash-4.2-patched/builtins/fc.def 2010-05-30 18:25:38.000000000 -0400
20 --- builtins/fc.def 2011-04-19 15:46:17.000000000 -0400
25 ! if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
26 while (last_hist >= 0 && hlist[last_hist] == 0)
31 ! if (i == last_hist && hlist[last_hist] == 0)
32 while (last_hist >= 0 && hlist[last_hist] == 0)
37 int sign, n, clen, rh;
43 int sign, n, clen, rh;
44 ! register int i, j, last_hist;
49 calculation as if it were on. */
50 rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
51 ! i -= rh + hist_last_line_added;
53 /* No specification defaults to most recent command. */
55 calculation as if it were on. */
56 rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
57 ! last_hist = i - rh - hist_last_line_added;
59 ! if (i == last_hist && hlist[last_hist] == 0)
60 ! while (last_hist >= 0 && hlist[last_hist] == 0)
67 /* No specification defaults to most recent command. */
68 *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
69 --- patchlevel.h Thu Feb 24 21:41:34 2011
72 looks for to find the patch level (for the sccs version string). */
74 ! #define PATCHLEVEL 8
76 #endif /* _PATCHLEVEL_H_ */
78 looks for to find the patch level (for the sccs version string). */
80 ! #define PATCHLEVEL 9
82 #endif /* _PATCHLEVEL_H_ */