]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/bash/bash43-014
readline: update to 8.0 (patchlevel 1)
[ipfire-2.x.git] / src / patches / bash / bash43-014
CommitLineData
d19c8267
AF
1 BASH PATCH REPORT
2 =================
3
4Bash-Release: 4.3
5Patch-ID: bash43-014
6
7Bug-Reported-by: Greg Wooledge <wooledg@eeg.ccf.org>
8Bug-Reference-ID: <20140418202123.GB7660@eeg.ccf.org>
9Bug-Reference-URL: http://lists.gnu.org/archive/html/help-bash/2014-04/msg00004.html
10
11Bug-Description:
12
13Under certain circumstances, $@ is expanded incorrectly in contexts where
14word splitting is not performed.
15
16Patch (apply with `patch -p0'):
17*** ../bash-4.3-patched/subst.c 2014-01-23 16:26:37.000000000 -0500
18--- subst.c 2014-04-19 15:41:26.000000000 -0400
19***************
20*** 3249,3254 ****
21--- 3249,3256 ----
22 return ((char *)NULL);
23
24+ expand_no_split_dollar_star = 1;
25 w->flags |= W_NOSPLIT2;
26 l = call_expand_word_internal (w, 0, 0, (int *)0, (int *)0);
27+ expand_no_split_dollar_star = 0;
28 if (l)
29 {
30***************
31*** 7848,7851 ****
32--- 7850,7857 ----
33 according to POSIX.2, this expands to a list of the positional
34 parameters no matter what IFS is set to. */
35+ /* XXX - what to do when in a context where word splitting is not
36+ performed? Even when IFS is not the default, posix seems to imply
37+ that we behave like unquoted $* ? Maybe we should use PF_NOSPLIT2
38+ here. */
39 temp = string_list_dollar_at (list, (pflags & PF_ASSIGNRHS) ? (quoted|Q_DOUBLE_QUOTES) : quoted);
40
41***************
42*** 8817,8820 ****
43--- 8823,8827 ----
44 {
45 char *ifs_chars;
46+ char *tstring;
47
48 ifs_chars = (quoted_dollar_at || has_dollar_at) ? ifs_value : (char *)NULL;
49***************
50*** 8831,8834 ****
51--- 8838,8865 ----
52 if (split_on_spaces)
53 list = list_string (istring, " ", 1); /* XXX quoted == 1? */
54+ /* If we have $@ (has_dollar_at != 0) and we are in a context where we
55+ don't want to split the result (W_NOSPLIT2), and we are not quoted,
56+ we have already separated the arguments with the first character of
57+ $IFS. In this case, we want to return a list with a single word
58+ with the separator possibly replaced with a space (it's what other
59+ shells seem to do).
60+ quoted_dollar_at is internal to this function and is set if we are
61+ passed an argument that is unquoted (quoted == 0) but we encounter a
62+ double-quoted $@ while expanding it. */
63+ else if (has_dollar_at && quoted_dollar_at == 0 && ifs_chars && quoted == 0 && (word->flags & W_NOSPLIT2))
64+ {
65+ /* Only split and rejoin if we have to */
66+ if (*ifs_chars && *ifs_chars != ' ')
67+ {
68+ list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1);
69+ tstring = string_list (list);
70+ }
71+ else
72+ tstring = istring;
73+ tword = make_bare_word (tstring);
74+ if (tstring != istring)
75+ free (tstring);
76+ goto set_word_flags;
77+ }
78 else if (has_dollar_at && ifs_chars)
79 list = list_string (istring, *ifs_chars ? ifs_chars : " ", 1);
80***************
81*** 8836,8839 ****
82--- 8867,8871 ----
83 {
84 tword = make_bare_word (istring);
85+ set_word_flags:
86 if ((quoted & (Q_DOUBLE_QUOTES|Q_HERE_DOCUMENT)) || (quoted_state == WHOLLY_QUOTED))
87 tword->flags |= W_QUOTED;
88*** ../bash-4.3/patchlevel.h 2012-12-29 10:47:57.000000000 -0500
89--- patchlevel.h 2014-03-20 20:01:28.000000000 -0400
90***************
91*** 26,30 ****
92 looks for to find the patch level (for the sccs version string). */
93
94! #define PATCHLEVEL 13
95
96 #endif /* _PATCHLEVEL_H_ */
97--- 26,30 ----
98 looks for to find the patch level (for the sccs version string). */
99
100! #define PATCHLEVEL 14
101
102 #endif /* _PATCHLEVEL_H_ */