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