123-upstream-bash43-023.patch (2766B)
1 BASH PATCH REPORT 2 ================= 3 4 Bash-Release: 4.3 5 Patch-ID: bash43-023 6 7 Bug-Reported-by: Tim Friske <me@timfriske.com> 8 Bug-Reference-ID: <CAM1RzOcOR9zzC2i+aeES6LtbHNHoOV+0pZEYPrqxv_QAii-RXA@mail.gmail.com> 9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00056.html 10 11 Bug-Description: 12 13 Bash does not correctly parse process substitution constructs that contain 14 unbalanced parentheses as part of the contained command. 15 16 Patch (apply with `patch -p0'): 17 18 --- a/subst.h 19 +++ b/subst.h 20 @@ -82,7 +82,7 @@ extern char *extract_arithmetic_subst __ 21 /* Extract the <( or >( construct in STRING, and return a new string. 22 Start extracting at (SINDEX) as if we had just seen "<(". 23 Make (SINDEX) get the position just after the matching ")". */ 24 -extern char *extract_process_subst __P((char *, char *, int *)); 25 +extern char *extract_process_subst __P((char *, char *, int *, int)); 26 #endif /* PROCESS_SUBSTITUTION */ 27 28 /* Extract the name of the variable to bind to from the assignment string. */ 29 --- a/subst.c 30 +++ b/subst.c 31 @@ -1192,12 +1192,18 @@ extract_arithmetic_subst (string, sindex 32 Start extracting at (SINDEX) as if we had just seen "<(". 33 Make (SINDEX) get the position of the matching ")". */ /*))*/ 34 char * 35 -extract_process_subst (string, starter, sindex) 36 +extract_process_subst (string, starter, sindex, xflags) 37 char *string; 38 char *starter; 39 int *sindex; 40 + int xflags; 41 { 42 +#if 0 43 return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND)); 44 +#else 45 + xflags |= (no_longjmp_on_fatal_error ? SX_NOLONGJMP : 0); 46 + return (xparse_dolparen (string, string+*sindex, sindex, xflags)); 47 +#endif 48 } 49 #endif /* PROCESS_SUBSTITUTION */ 50 51 @@ -1785,7 +1791,7 @@ skip_to_delim (string, start, delims, fl 52 si = i + 2; 53 if (string[si] == '\0') 54 CQ_RETURN(si); 55 - temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si); 56 + temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si, 0); 57 free (temp); /* no SX_ALLOC here */ 58 i = si; 59 if (string[i] == '\0') 60 @@ -8249,7 +8255,7 @@ add_string: 61 else 62 t_index = sindex + 1; /* skip past both '<' and LPAREN */ 63 64 - temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index); /*))*/ 65 + temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index, 0); /*))*/ 66 sindex = t_index; 67 68 /* If the process substitution specification is `<()', we want to 69 --- a/patchlevel.h 70 +++ b/patchlevel.h 71 @@ -25,6 +25,6 @@ 72 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh 73 looks for to find the patch level (for the sccs version string). */ 74 75 -#define PATCHLEVEL 22 76 +#define PATCHLEVEL 23 77 78 #endif /* _PATCHLEVEL_H_ */