7
Bug-Reported-by: gregrwm <backuppc-users@whitleymott.net>
8
Bug-Reference-ID: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
9
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2012-05/msg00108.html
13
Bash-4.2 produces incorrect word splitting results when expanding
14
double-quoted $@ in the same string as and adjacent to other variable
15
expansions. The $@ should be split, the other expansions should not.
17
Patch (apply with `patch -p0'):
19
Index: b/bash/patchlevel.h
20
===================================================================
21
--- a/bash/patchlevel.h
22
+++ b/bash/patchlevel.h
24
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
25
looks for to find the patch level (for the sccs version string). */
27
-#define PATCHLEVEL 35
28
+#define PATCHLEVEL 36
30
#endif /* _PATCHLEVEL_H_ */
32
===================================================================
40
+ int has_dollar_at, temp_has_dollar_at;
42
int pflags; /* flags passed to param_expand */
44
@@ -8127,13 +8127,14 @@
45
if (expanded_something)
46
*expanded_something = 1;
49
+ temp_has_dollar_at = 0;
50
pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
51
if (word->flags & W_NOSPLIT2)
52
pflags |= PF_NOSPLIT2;
53
tword = param_expand (string, &sindex, quoted, expanded_something,
54
- &has_dollar_at, "ed_dollar_at,
55
+ &temp_has_dollar_at, "ed_dollar_at,
56
&had_quoted_null, pflags);
57
+ has_dollar_at += temp_has_dollar_at;
59
if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
61
@@ -8274,9 +8275,10 @@
66
+ temp_has_dollar_at = 0; /* XXX */
67
/* Need to get W_HASQUOTEDNULL flag through this function. */
68
- list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
69
+ list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &temp_has_dollar_at, (int *)NULL);
70
+ has_dollar_at += temp_has_dollar_at;
72
if (list == &expand_word_error || list == &expand_word_fatal)