]>
Commit | Line | Data |
---|---|---|
bd03fb8f AM |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 4.0 | |
5 | Patch-ID: bash40-014 | |
6 | ||
7 | Bug-Reported-by: smallnow@gmail.com | |
8 | Bug-Reference-ID: <49C460FE.40307@gmail.com> | |
9 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-03/msg00166.html | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | When the fc builtin is run in a command substitution from a shell with history | |
14 | enabled, it does not correctly calculate the command on which to operate. | |
15 | ||
16 | Patch: | |
17 | ||
18 | *** ../bash-4.0-patched/builtins/fc.def 2009-01-04 14:32:22.000000000 -0500 | |
19 | --- builtins/fc.def 2009-03-21 14:03:43.000000000 -0400 | |
20 | *************** | |
21 | *** 89,92 **** | |
22 | --- 89,93 ---- | |
23 | extern int literal_history; | |
24 | extern int posixly_correct; | |
25 | + extern int subshell_environment, interactive_shell; | |
26 | ||
27 | extern int unlink __P((const char *)); | |
28 | *************** | |
29 | *** 173,177 **** | |
30 | register char *sep; | |
31 | int numbering, reverse, listing, execute; | |
32 | ! int histbeg, histend, last_hist, retval, opt; | |
33 | FILE *stream; | |
34 | REPL *rlist, *rl; | |
35 | --- 174,178 ---- | |
36 | register char *sep; | |
37 | int numbering, reverse, listing, execute; | |
38 | ! int histbeg, histend, last_hist, retval, opt, rh; | |
39 | FILE *stream; | |
40 | REPL *rlist, *rl; | |
41 | *************** | |
42 | *** 276,279 **** | |
43 | --- 277,282 ---- | |
44 | fprintf (stderr, "%s\n", command); | |
45 | fc_replhist (command); /* replace `fc -s' with command */ | |
46 | + /* Posix says that the re-executed commands should be entered into the | |
47 | + history. */ | |
48 | return (parse_and_execute (command, "fc", SEVAL_NOHIST)); | |
49 | } | |
50 | *************** | |
51 | *** 294,298 **** | |
52 | so we check hist_last_line_added. */ | |
53 | ||
54 | ! last_hist = i - remember_on_history - hist_last_line_added; | |
55 | ||
56 | if (list) | |
57 | --- 297,306 ---- | |
58 | so we check hist_last_line_added. */ | |
59 | ||
60 | ! /* Even though command substitution through parse_and_execute turns off | |
61 | ! remember_on_history, command substitution in a shell when set -o history | |
62 | ! has been enabled (interactive or not) should use it in the last_hist | |
63 | ! calculation as if it were on. */ | |
64 | ! rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); | |
65 | ! last_hist = i - rh - hist_last_line_added; | |
66 | ||
67 | if (list) | |
68 | *************** | |
69 | *** 457,461 **** | |
70 | HIST_ENTRY **hlist; | |
71 | { | |
72 | ! int sign, n, clen; | |
73 | register int i, j; | |
74 | register char *s; | |
75 | --- 465,469 ---- | |
76 | HIST_ENTRY **hlist; | |
77 | { | |
78 | ! int sign, n, clen, rh; | |
79 | register int i, j; | |
80 | register char *s; | |
81 | *************** | |
82 | *** 473,477 **** | |
83 | so we check hist_last_line_added. This needs to agree with the | |
84 | calculation of last_hist in fc_builtin above. */ | |
85 | ! i -= remember_on_history + hist_last_line_added; | |
86 | ||
87 | /* No specification defaults to most recent command. */ | |
88 | --- 481,490 ---- | |
89 | so we check hist_last_line_added. This needs to agree with the | |
90 | calculation of last_hist in fc_builtin above. */ | |
91 | ! /* Even though command substitution through parse_and_execute turns off | |
92 | ! remember_on_history, command substitution in a shell when set -o history | |
93 | ! has been enabled (interactive or not) should use it in the last_hist | |
94 | ! calculation as if it were on. */ | |
95 | ! rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list); | |
96 | ! i -= rh + hist_last_line_added; | |
97 | ||
98 | /* No specification defaults to most recent command. */ | |
99 | *** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500 | |
100 | --- patchlevel.h 2009-02-22 16:11:31.000000000 -0500 | |
101 | *************** | |
102 | *** 26,30 **** | |
103 | looks for to find the patch level (for the sccs version string). */ | |
104 | ||
105 | ! #define PATCHLEVEL 13 | |
106 | ||
107 | #endif /* _PATCHLEVEL_H_ */ | |
108 | --- 26,30 ---- | |
109 | looks for to find the patch level (for the sccs version string). */ | |
110 | ||
111 | ! #define PATCHLEVEL 14 | |
112 | ||
113 | #endif /* _PATCHLEVEL_H_ */ |