source: patches/bash-4.3-branch_update-2.patch@ bfa06fb

clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since bfa06fb was 94a653a, checked in by William Harrington <kb0iic@…>, 11 years ago

Add bash 4.3 branch update 2 patch for level 11.

  • Property mode set to 100644
File size: 13.7 KB
RevLine 
[94a653a]1Submitted By: William Harrington (kb0iic at cross-lfs dot org)
2Date: 03-30-2014
3Initial Package Version: 4.3
4Origin: Upstream
5Upstream Status: Applied
6Description: Contains all upstream patches up to 4.3-011
7
8diff -Naur bash-4.3.orig/arrayfunc.c bash-4.3/arrayfunc.c
9--- bash-4.3.orig/arrayfunc.c 2013-08-02 15:19:59.000000000 -0500
10+++ bash-4.3/arrayfunc.c 2014-04-24 20:08:49.474314102 -0500
11@@ -597,6 +597,11 @@
12 if (assoc_p (var))
13 {
14 val = expand_assignment_string_to_string (val, 0);
15+ if (val == 0)
16+ {
17+ val = (char *)xmalloc (1);
18+ val[0] = '\0'; /* like do_assignment_internal */
19+ }
20 free_val = 1;
21 }
22
23diff -Naur bash-4.3.orig/externs.h bash-4.3/externs.h
24--- bash-4.3.orig/externs.h 2014-01-02 13:58:20.000000000 -0600
25+++ bash-4.3/externs.h 2014-04-24 20:08:54.927367945 -0500
26@@ -324,6 +324,7 @@
27 extern char *sh_backslash_quote __P((char *, const char *, int));
28 extern char *sh_backslash_quote_for_double_quotes __P((char *));
29 extern int sh_contains_shell_metas __P((char *));
30+extern int sh_contains_quotes __P((char *));
31
32 /* declarations for functions defined in lib/sh/spell.c */
33 extern int spname __P((char *, char *));
34diff -Naur bash-4.3.orig/jobs.c bash-4.3/jobs.c
35--- bash-4.3.orig/jobs.c 2014-01-10 08:05:34.000000000 -0600
36+++ bash-4.3/jobs.c 2014-04-24 20:08:47.897732294 -0500
37@@ -4374,7 +4374,7 @@
38 void
39 end_job_control ()
40 {
41- if (interactive_shell) /* XXX - should it be interactive? */
42+ if (interactive_shell || job_control) /* XXX - should it be just job_control? */
43 {
44 terminate_stopped_jobs ();
45
46diff -Naur bash-4.3.orig/lib/glob/glob.c bash-4.3/lib/glob/glob.c
47--- bash-4.3.orig/lib/glob/glob.c 2014-01-31 20:43:51.000000000 -0600
48+++ bash-4.3/lib/glob/glob.c 2014-04-24 20:08:51.054232810 -0500
49@@ -179,42 +179,50 @@
50 char *pat, *dname;
51 int flags;
52 {
53- char *pp, *pe, *t;
54- int n, r;
55+ char *pp, *pe, *t, *se;
56+ int n, r, negate;
57
58+ negate = *pat == '!';
59 pp = pat + 2;
60- pe = pp + strlen (pp) - 1; /*(*/
61- if (*pe != ')')
62- return 0;
63- if ((t = strchr (pp, '|')) == 0) /* easy case first */
64+ se = pp + strlen (pp) - 1; /* end of string */
65+ pe = glob_patscan (pp, se, 0); /* end of extglob pattern (( */
66+ /* we should check for invalid extglob pattern here */
67+ /* if pe != se we have more of the pattern at the end of the extglob
68+ pattern. Check the easy case first ( */
69+ if (pe == se && *pe == ')' && (t = strchr (pp, '|')) == 0)
70 {
71 *pe = '\0';
72+#if defined (HANDLE_MULTIBYTE)
73+ r = mbskipname (pp, dname, flags);
74+#else
75 r = skipname (pp, dname, flags); /*(*/
76+#endif
77 *pe = ')';
78 return r;
79 }
80+
81+ /* check every subpattern */
82 while (t = glob_patscan (pp, pe, '|'))
83 {
84 n = t[-1];
85 t[-1] = '\0';
86+#if defined (HANDLE_MULTIBYTE)
87+ r = mbskipname (pp, dname, flags);
88+#else
89 r = skipname (pp, dname, flags);
90+#endif
91 t[-1] = n;
92 if (r == 0) /* if any pattern says not skip, we don't skip */
93 return r;
94 pp = t;
95 } /*(*/
96
97- if (pp == pe) /* glob_patscan might find end of pattern */
98+ /* glob_patscan might find end of pattern */
99+ if (pp == se)
100 return r;
101
102- *pe = '\0';
103-# if defined (HANDLE_MULTIBYTE)
104- r = mbskipname (pp, dname, flags); /*(*/
105-# else
106- r = skipname (pp, dname, flags); /*(*/
107-# endif
108- *pe = ')';
109- return r;
110+ /* but if it doesn't then we didn't match a leading dot */
111+ return 0;
112 }
113 #endif
114
115@@ -277,20 +285,23 @@
116 int flags;
117 {
118 #if EXTENDED_GLOB
119- wchar_t *pp, *pe, *t, n;
120- int r;
121+ wchar_t *pp, *pe, *t, n, *se;
122+ int r, negate;
123
124+ negate = *pat == L'!';
125 pp = pat + 2;
126- pe = pp + wcslen (pp) - 1; /*(*/
127- if (*pe != L')')
128- return 0;
129- if ((t = wcschr (pp, L'|')) == 0)
130+ se = pp + wcslen (pp) - 1; /*(*/
131+ pe = glob_patscan_wc (pp, se, 0);
132+
133+ if (pe == se && *pe == ')' && (t = wcschr (pp, L'|')) == 0)
134 {
135 *pe = L'\0';
136 r = wchkname (pp, dname); /*(*/
137 *pe = L')';
138 return r;
139 }
140+
141+ /* check every subpattern */
142 while (t = glob_patscan_wc (pp, pe, '|'))
143 {
144 n = t[-1];
145@@ -305,10 +316,8 @@
146 if (pp == pe) /* glob_patscan_wc might find end of pattern */
147 return r;
148
149- *pe = L'\0';
150- r = wchkname (pp, dname); /*(*/
151- *pe = L')';
152- return r;
153+ /* but if it doesn't then we didn't match a leading dot */
154+ return 0;
155 #else
156 return (wchkname (pat, dname));
157 #endif
158diff -Naur bash-4.3.orig/lib/glob/gmisc.c bash-4.3/lib/glob/gmisc.c
159--- bash-4.3.orig/lib/glob/gmisc.c 2013-10-28 13:45:25.000000000 -0500
160+++ bash-4.3/lib/glob/gmisc.c 2014-04-24 20:08:51.054232810 -0500
161@@ -210,6 +210,7 @@
162 case '+':
163 case '!':
164 case '@':
165+ case '?':
166 return (pat[1] == LPAREN);
167 default:
168 return 0;
169diff -Naur bash-4.3.orig/lib/readline/display.c bash-4.3/lib/readline/display.c
170--- bash-4.3.orig/lib/readline/display.c 2013-12-27 12:10:56.000000000 -0600
171+++ bash-4.3/lib/readline/display.c 2014-04-24 20:08:56.493955444 -0500
172@@ -2677,7 +2677,8 @@
173 {
174 if (_rl_echoing_p)
175 {
176- _rl_move_vert (_rl_vis_botlin);
177+ if (_rl_vis_botlin > 0) /* minor optimization plus bug fix */
178+ _rl_move_vert (_rl_vis_botlin);
179 _rl_vis_botlin = 0;
180 fflush (rl_outstream);
181 rl_restart_output (1, 0);
182diff -Naur bash-4.3.orig/lib/readline/readline.c bash-4.3/lib/readline/readline.c
183--- bash-4.3.orig/lib/readline/readline.c 2013-10-28 13:58:06.000000000 -0500
184+++ bash-4.3/lib/readline/readline.c 2014-04-24 20:08:44.507909810 -0500
185@@ -744,7 +744,8 @@
186 r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
187
188 RL_CHECK_SIGNALS ();
189- if (r == 0) /* success! */
190+ /* We only treat values < 0 specially to simulate recursion. */
191+ if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
192 {
193 _rl_keyseq_chain_dispose ();
194 RL_UNSETSTATE (RL_STATE_MULTIKEY);
195@@ -964,7 +965,7 @@
196 #if defined (VI_MODE)
197 if (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap &&
198 key != ANYOTHERKEY &&
199- rl_key_sequence_length == 1 && /* XXX */
200+ _rl_dispatching_keymap == vi_movement_keymap &&
201 _rl_vi_textmod_command (key))
202 _rl_vi_set_last (key, rl_numeric_arg, rl_arg_sign);
203 #endif
204diff -Naur bash-4.3.orig/lib/sh/shquote.c bash-4.3/lib/sh/shquote.c
205--- bash-4.3.orig/lib/sh/shquote.c 2013-03-31 20:53:32.000000000 -0500
206+++ bash-4.3/lib/sh/shquote.c 2014-04-24 20:08:54.927367945 -0500
207@@ -311,3 +311,17 @@
208
209 return (0);
210 }
211+
212+int
213+sh_contains_quotes (string)
214+ char *string;
215+{
216+ char *s;
217+
218+ for (s = string; s && *s; s++)
219+ {
220+ if (*s == '\'' || *s == '"' || *s == '\\')
221+ return 1;
222+ }
223+ return 0;
224+}
225diff -Naur bash-4.3.orig/parse.y bash-4.3/parse.y
226--- bash-4.3.orig/parse.y 2014-02-11 08:42:10.000000000 -0600
227+++ bash-4.3/parse.y 2014-04-24 20:08:52.607486462 -0500
228@@ -2424,7 +2424,7 @@
229 not already end in an EOF character. */
230 if (shell_input_line_terminator != EOF)
231 {
232- if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)
233+ if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size))
234 shell_input_line = (char *)xrealloc (shell_input_line,
235 1 + (shell_input_line_size += 2));
236
237@@ -3398,7 +3398,7 @@
238 within a double-quoted ${...} construct "an even number of
239 unescaped double-quotes or single-quotes, if any, shall occur." */
240 /* This was changed in Austin Group Interp 221 */
241- if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
242+ if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
243 continue;
244
245 /* Could also check open == '`' if we want to parse grouping constructs
246diff -Naur bash-4.3.orig/patchlevel.h bash-4.3/patchlevel.h
247--- bash-4.3.orig/patchlevel.h 2012-12-29 09:47:57.000000000 -0600
248+++ bash-4.3/patchlevel.h 2014-04-24 20:08:56.493955444 -0500
249@@ -25,6 +25,6 @@
250 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
251 looks for to find the patch level (for the sccs version string). */
252
253-#define PATCHLEVEL 0
254+#define PATCHLEVEL 11
255
256 #endif /* _PATCHLEVEL_H_ */
257diff -Naur bash-4.3.orig/pcomplete.c bash-4.3/pcomplete.c
258--- bash-4.3.orig/pcomplete.c 2013-08-26 14:23:45.000000000 -0500
259+++ bash-4.3/pcomplete.c 2014-04-24 20:08:54.927367945 -0500
260@@ -183,6 +183,7 @@
261
262 COMPSPEC *pcomp_curcs;
263 const char *pcomp_curcmd;
264+const char *pcomp_curtxt;
265
266 #ifdef DEBUG
267 /* Debugging code */
268@@ -753,6 +754,32 @@
269 quoted strings. */
270 dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
271 }
272+ /* Intended to solve a mismatched assumption by bash-completion. If
273+ the text to be completed is empty, but bash-completion turns it into
274+ a quoted string ('') assuming that this code will dequote it before
275+ calling readline, do the dequoting. */
276+ else if (iscompgen && iscompleting &&
277+ pcomp_curtxt && *pcomp_curtxt == 0 &&
278+ text && (*text == '\'' || *text == '"') && text[1] == text[0] && text[2] == 0 &&
279+ rl_filename_dequoting_function)
280+ dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
281+ /* Another mismatched assumption by bash-completion. If compgen is being
282+ run as part of bash-completion, and the argument to compgen is not
283+ the same as the word originally passed to the programmable completion
284+ code, dequote the argument if it has quote characters. It's an
285+ attempt to detect when bash-completion is quoting its filename
286+ argument before calling compgen. */
287+ /* We could check whether gen_shell_function_matches is in the call
288+ stack by checking whether the gen-shell-function-matches tag is in
289+ the unwind-protect stack, but there's no function to do that yet.
290+ We could simply check whether we're executing in a function by
291+ checking variable_context, and may end up doing that. */
292+ else if (iscompgen && iscompleting && rl_filename_dequoting_function &&
293+ pcomp_curtxt && text &&
294+ STREQ (pcomp_curtxt, text) == 0 &&
295+ variable_context &&
296+ sh_contains_quotes (text)) /* guess */
297+ dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
298 else
299 dfn = savestring (text);
300 }
301@@ -1522,7 +1549,7 @@
302 COMPSPEC **lastcs;
303 {
304 COMPSPEC *cs, *oldcs;
305- const char *oldcmd;
306+ const char *oldcmd, *oldtxt;
307 STRINGLIST *ret;
308
309 cs = progcomp_search (ocmd);
310@@ -1545,14 +1572,17 @@
311
312 oldcs = pcomp_curcs;
313 oldcmd = pcomp_curcmd;
314+ oldtxt = pcomp_curtxt;
315
316 pcomp_curcs = cs;
317 pcomp_curcmd = cmd;
318+ pcomp_curtxt = word;
319
320 ret = gen_compspec_completions (cs, cmd, word, start, end, foundp);
321
322 pcomp_curcs = oldcs;
323 pcomp_curcmd = oldcmd;
324+ pcomp_curtxt = oldtxt;
325
326 /* We need to conditionally handle setting *retryp here */
327 if (retryp)
328diff -Naur bash-4.3.orig/test.c bash-4.3/test.c
329--- bash-4.3.orig/test.c 2014-02-04 15:52:58.000000000 -0600
330+++ bash-4.3/test.c 2014-04-24 20:08:39.174864532 -0500
331@@ -646,8 +646,8 @@
332 return (v && invisible_p (v) == 0 && var_isset (v) ? TRUE : FALSE);
333
334 case 'R':
335- v = find_variable (arg);
336- return (v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v) ? TRUE : FALSE);
337+ v = find_variable_noref (arg);
338+ return ((v && invisible_p (v) == 0 && var_isset (v) && nameref_p (v)) ? TRUE : FALSE);
339 }
340
341 /* We can't actually get here, but this shuts up gcc. */
342@@ -723,6 +723,7 @@
343 case 'o': case 'p': case 'r': case 's': case 't':
344 case 'u': case 'v': case 'w': case 'x': case 'z':
345 case 'G': case 'L': case 'O': case 'S': case 'N':
346+ case 'R':
347 return (1);
348 }
349
350diff -Naur bash-4.3.orig/trap.c bash-4.3/trap.c
351--- bash-4.3.orig/trap.c 2014-02-05 09:03:21.000000000 -0600
352+++ bash-4.3/trap.c 2014-04-24 20:08:41.401408370 -0500
353@@ -920,7 +920,8 @@
354 subst_assign_varlist = 0;
355
356 #if defined (JOB_CONTROL)
357- save_pipeline (1); /* XXX only provides one save level */
358+ if (sig != DEBUG_TRAP) /* run_debug_trap does this */
359+ save_pipeline (1); /* XXX only provides one save level */
360 #endif
361
362 /* If we're in a function, make sure return longjmps come here, too. */
363@@ -940,7 +941,8 @@
364 trap_exit_value = last_command_exit_value;
365
366 #if defined (JOB_CONTROL)
367- restore_pipeline (1);
368+ if (sig != DEBUG_TRAP) /* run_debug_trap does this */
369+ restore_pipeline (1);
370 #endif
371
372 subst_assign_varlist = save_subst_varlist;
373diff -Naur bash-4.3.orig/y.tab.c bash-4.3/y.tab.c
374--- bash-4.3.orig/y.tab.c 2014-02-11 09:57:47.000000000 -0600
375+++ bash-4.3/y.tab.c 2014-04-24 20:08:52.607486462 -0500
376@@ -4736,7 +4736,7 @@
377 not already end in an EOF character. */
378 if (shell_input_line_terminator != EOF)
379 {
380- if (shell_input_line_size < SIZE_MAX && shell_input_line_len > shell_input_line_size - 3)
381+ if (shell_input_line_size < SIZE_MAX-3 && (shell_input_line_len+3 > shell_input_line_size))
382 shell_input_line = (char *)xrealloc (shell_input_line,
383 1 + (shell_input_line_size += 2));
384
385@@ -5710,7 +5710,7 @@
386 within a double-quoted ${...} construct "an even number of
387 unescaped double-quotes or single-quotes, if any, shall occur." */
388 /* This was changed in Austin Group Interp 221 */
389- if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
390+ if MBTEST(posixly_correct && shell_compatibility_level > 41 && dolbrace_state != DOLBRACE_QUOTE && dolbrace_state != DOLBRACE_QUOTE2 && (flags & P_DQUOTE) && (flags & P_DOLBRACE) && ch == '\'')
391 continue;
392
393 /* Could also check open == '`' if we want to parse grouping constructs
Note: See TracBrowser for help on using the repository browser.