summaryrefslogtreecommitdiff
path: root/patches/source/bash/bash-4.1-patches/bash41-011
diff options
context:
space:
mode:
Diffstat (limited to 'patches/source/bash/bash-4.1-patches/bash41-011')
-rw-r--r--patches/source/bash/bash-4.1-patches/bash41-01186
1 files changed, 86 insertions, 0 deletions
diff --git a/patches/source/bash/bash-4.1-patches/bash41-011 b/patches/source/bash/bash-4.1-patches/bash41-011
new file mode 100644
index 00000000..050da955
--- /dev/null
+++ b/patches/source/bash/bash-4.1-patches/bash41-011
@@ -0,0 +1,86 @@
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 4.1
+Patch-ID: bash41-011
+
+Bug-Reported-by: <piuma@piumalab.org>
+Bug-Reference-ID: <4DAAC0DB.7060606@piumalab.org>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html
+
+Bug-Description:
+
+Under certain circumstances, running `fc -l' two times in succession with a
+relative history offset at the end of the history will result in an incorrect
+calculation of the last history entry and a seg fault.
+
+Patch (apply with `patch -p0'):
+
+*** ../bash-4.1-patched/builtins/fc.def 2009-03-21 14:03:43.000000000 -0400
+--- builtins/fc.def 2011-04-19 15:46:17.000000000 -0400
+***************
+*** 304,307 ****
+--- 304,317 ----
+ last_hist = i - rh - hist_last_line_added;
+
++ /* XXX */
++ if (i == last_hist && hlist[last_hist] == 0)
++ while (last_hist >= 0 && hlist[last_hist] == 0)
++ last_hist--;
++ if (last_hist < 0)
++ {
++ sh_erange ((char *)NULL, _("history specification"));
++ return (EXECUTION_FAILURE);
++ }
++
+ if (list)
+ {
+***************
+*** 466,470 ****
+ {
+ int sign, n, clen, rh;
+! register int i, j;
+ register char *s;
+
+--- 476,480 ----
+ {
+ int sign, n, clen, rh;
+! register int i, j, last_hist;
+ register char *s;
+
+***************
+*** 486,490 ****
+ calculation as if it were on. */
+ rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
+! i -= rh + hist_last_line_added;
+
+ /* No specification defaults to most recent command. */
+--- 496,508 ----
+ calculation as if it were on. */
+ rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
+! last_hist = i - rh - hist_last_line_added;
+!
+! if (i == last_hist && hlist[last_hist] == 0)
+! while (last_hist >= 0 && hlist[last_hist] == 0)
+! last_hist--;
+! if (last_hist < 0)
+! return (-1);
+!
+! i = last_hist;
+
+ /* No specification defaults to most recent command. */
+*** ../bash-4.1-patched/patchlevel.h 2009-10-01 16:39:22.000000000 -0400
+--- patchlevel.h 2010-01-14 09:38:08.000000000 -0500
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 10
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 11
+
+ #endif /* _PATCHLEVEL_H_ */