ulogd: moved to github
[openwrt.org/packages.git] / utils / 101-upstream-bash42-001.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
                             BASH PATCH REPORT
                             =================
 
Bash-Release:   4.2
Patch-ID:       bash42-001
 
Bug-Reported-by:        Juergen Daubert <jue@jue.li>
Bug-Reference-ID:       <20110214175132.GA19813@jue.netz>
Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00125.html
 
Bug-Description:
 
When running in Posix mode, bash does not correctly expand the right-hand
side of a double-quoted word expansion containing single quotes.
 
Patch (apply with `patch -p0'):
 
--- a/subst.c
+++ b/subst.c
@@ -1379,10 +1379,12 @@ extract_dollar_brace_string (string, sin
   slen = strlen (string + *sindex) + *sindex;
 
   /* The handling of dolbrace_state needs to agree with the code in parse.y:
-     parse_matched_pair() */
-  dolbrace_state = 0;
-  if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
-    dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
+     parse_matched_pair().  The different initial value is to handle the
+     case where this function is called to parse the word in
+     ${param op word} (SX_WORD). */
+  dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
+  if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
+    dolbrace_state = DOLBRACE_QUOTE;
 
   i = *sindex;
   while (c = string[i])
@@ -7176,7 +7178,7 @@ parameter_brace_expand (string, indexp, 
     {
       /* Extract the contents of the ${ ... } expansion
         according to the Posix.2 rules. */
-      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
+      value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
       if (string[sindex] == RBRACE)
        sindex++;
       else
--- a/subst.h
+++ b/subst.h
@@ -56,6 +56,7 @@
 #define SX_NOLONGJMP   0x0040  /* don't longjmp on fatal error */
 #define SX_ARITHSUB    0x0080  /* extracting $(( ... )) (currently unused) */
 #define SX_POSIXEXP    0x0100  /* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
+#define SX_WORD                0x0200  /* extracting word in ${param op word} */
 
 /* Remove backslashes which are quoting backquotes from STRING.  Modifies
    STRING, and returns a pointer to it. */
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -25,6 +25,6 @@
    regexp `^#define[   ]*PATCHLEVEL', since that's what support/mkversion.sh
    looks for to find the patch level (for the sccs version string). */
 
-#define PATCHLEVEL 0
+#define PATCHLEVEL 1
 
 #endif /* _PATCHLEVEL_H_ */
 
comments