1 BASH PATCH REPORT |
|
2 ================= |
|
3 |
|
4 Bash-Release: 4.1 |
|
5 Patch-ID: bash41-011 |
|
6 |
|
7 Bug-Reported-by: <[email protected]> |
|
8 Bug-Reference-ID: <[email protected]> |
|
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2011-04/msg00075.html |
|
10 |
|
11 Bug-Description: |
|
12 |
|
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. |
|
16 |
|
17 Patch (apply with `patch -p0'): |
|
18 |
|
19 *** ../bash-4.1-patched/builtins/fc.def 2009-03-21 14:03:43.000000000 -0400 |
|
20 --- builtins/fc.def 2011-04-19 15:46:17.000000000 -0400 |
|
21 *************** |
|
22 *** 304,307 **** |
|
23 --- 304,317 ---- |
|
24 last_hist = i - rh - hist_last_line_added; |
|
25 |
|
26 + /* XXX */ |
|
27 + if (i == last_hist && hlist[last_hist] == 0) |
|
28 + while (last_hist >= 0 && hlist[last_hist] == 0) |
|
29 + last_hist--; |
|
30 + if (last_hist < 0) |
|
31 + { |
|
32 + sh_erange ((char *)NULL, _("history specification")); |
|
33 + return (EXECUTION_FAILURE); |
|
34 + } |
|
35 + |
|
36 if (list) |
|
37 { |
|
38 *************** |
|
39 *** 466,470 **** |
|
40 { |
|
41 int sign, n, clen, rh; |
|
42 ! register int i, j; |
|
43 register char *s; |
|
44 |
|
45 --- 476,480 ---- |
|
46 { |
|
47 int sign, n, clen, rh; |
|
48 ! register int i, j, last_hist; |
|
49 register char *s; |
|
50 |
|
51 *************** |
|
52 *** 486,490 **** |
|
53 calculation as if it were on. */ |
|
54 rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); |
|
55 ! i -= rh + hist_last_line_added; |
|
56 |
|
57 /* No specification defaults to most recent command. */ |
|
58 --- 496,508 ---- |
|
59 calculation as if it were on. */ |
|
60 rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); |
|
61 ! last_hist = i - rh - hist_last_line_added; |
|
62 ! |
|
63 ! if (i == last_hist && hlist[last_hist] == 0) |
|
64 ! while (last_hist >= 0 && hlist[last_hist] == 0) |
|
65 ! last_hist--; |
|
66 ! if (last_hist < 0) |
|
67 ! return (-1); |
|
68 ! |
|
69 ! i = last_hist; |
|
70 |
|
71 /* No specification defaults to most recent command. */ |
|
72 *** ../bash-4.1-patched/patchlevel.h 2009-10-01 16:39:22.000000000 -0400 |
|
73 --- patchlevel.h 2010-01-14 09:38:08.000000000 -0500 |
|
74 *************** |
|
75 *** 26,30 **** |
|
76 looks for to find the patch level (for the sccs version string). */ |
|
77 |
|
78 ! #define PATCHLEVEL 10 |
|
79 |
|
80 #endif /* _PATCHLEVEL_H_ */ |
|
81 --- 26,30 ---- |
|
82 looks for to find the patch level (for the sccs version string). */ |
|
83 |
|
84 ! #define PATCHLEVEL 11 |
|
85 |
|
86 #endif /* _PATCHLEVEL_H_ */ |
|