]>
Commit | Line | Data |
---|---|---|
415fb8b5 PM |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 5.0 | |
5 | Patch-ID: bash50-002 | |
6 | ||
7 | Bug-Reported-by: Ante Peric <synthmeat@gmail.com> | |
8 | Bug-Reference-ID: <B7E3B567-2467-4F7B-B6B9-CA4E75A9C93F@gmail.com> | |
9 | Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2019-01/msg00095.html | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | When an alias value ends with an unquoted literal tab (not part of a quoted | |
14 | string or comment), alias expansion cannot correctly detect the end of the | |
15 | alias value after expanding it. | |
16 | ||
17 | Patch (apply with `patch -p0'): | |
18 | ||
19 | *** ../bash-5.0/parser.h 2018-12-28 19:11:18.000000000 -0500 | |
20 | --- parser.h 2019-01-11 15:13:03.000000000 -0500 | |
21 | *************** | |
22 | *** 48,51 **** | |
23 | --- 48,52 ---- | |
24 | #define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */ | |
25 | #define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */ | |
26 | + #define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */ | |
27 | ||
28 | /* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */ | |
29 | *** ../bash-5.0/parse.y 2019-01-02 13:57:34.000000000 -0500 | |
30 | --- parse.y 2019-01-14 08:23:31.000000000 -0500 | |
31 | *************** | |
32 | *** 2558,2567 **** | |
33 | pushed_string_list->flags != PSH_DPAREN && | |
34 | (parser_state & PST_COMMENT) == 0 && | |
35 | shell_input_line_index > 0 && | |
36 | ! shell_input_line[shell_input_line_index-1] != ' ' && | |
37 | shell_input_line[shell_input_line_index-1] != '\n' && | |
38 | shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && | |
39 | (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"')) | |
40 | { | |
41 | return ' '; /* END_ALIAS */ | |
42 | } | |
43 | --- 2558,2569 ---- | |
44 | pushed_string_list->flags != PSH_DPAREN && | |
45 | (parser_state & PST_COMMENT) == 0 && | |
46 | + (parser_state & PST_ENDALIAS) == 0 && /* only once */ | |
47 | shell_input_line_index > 0 && | |
48 | ! shellblank (shell_input_line[shell_input_line_index-1]) == 0 && | |
49 | shell_input_line[shell_input_line_index-1] != '\n' && | |
50 | shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && | |
51 | (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"')) | |
52 | { | |
53 | + parser_state |= PST_ENDALIAS; | |
54 | return ' '; /* END_ALIAS */ | |
55 | } | |
56 | *************** | |
57 | *** 2572,2575 **** | |
58 | --- 2574,2578 ---- | |
59 | if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE) | |
60 | { | |
61 | + parser_state &= ~PST_ENDALIAS; | |
62 | pop_string (); | |
63 | uc = shell_input_line[shell_input_line_index]; | |
64 | *** ../bash-5.0/y.tab.c 2019-01-02 13:57:43.000000000 -0500 | |
65 | --- y.tab.c 2019-01-14 08:39:23.000000000 -0500 | |
66 | *************** | |
67 | *** 4874,4883 **** | |
68 | pushed_string_list->flags != PSH_DPAREN && | |
69 | (parser_state & PST_COMMENT) == 0 && | |
70 | shell_input_line_index > 0 && | |
71 | ! shell_input_line[shell_input_line_index-1] != ' ' && | |
72 | shell_input_line[shell_input_line_index-1] != '\n' && | |
73 | shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && | |
74 | (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"')) | |
75 | { | |
76 | return ' '; /* END_ALIAS */ | |
77 | } | |
78 | --- 4874,4885 ---- | |
79 | pushed_string_list->flags != PSH_DPAREN && | |
80 | (parser_state & PST_COMMENT) == 0 && | |
81 | + (parser_state & PST_ENDALIAS) == 0 && /* only once */ | |
82 | shell_input_line_index > 0 && | |
83 | ! shellblank (shell_input_line[shell_input_line_index-1]) == 0 && | |
84 | shell_input_line[shell_input_line_index-1] != '\n' && | |
85 | shellmeta (shell_input_line[shell_input_line_index-1]) == 0 && | |
86 | (current_delimiter (dstack) != '\'' && current_delimiter (dstack) != '"')) | |
87 | { | |
88 | + parser_state |= PST_ENDALIAS; | |
89 | return ' '; /* END_ALIAS */ | |
90 | } | |
91 | *************** | |
92 | *** 4888,4891 **** | |
93 | --- 4890,4894 ---- | |
94 | if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE) | |
95 | { | |
96 | + parser_state &= ~PST_ENDALIAS; | |
97 | pop_string (); | |
98 | uc = shell_input_line[shell_input_line_index]; | |
99 | *** ../bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400 | |
100 | --- patchlevel.h 2016-10-01 11:01:28.000000000 -0400 | |
101 | *************** | |
102 | *** 26,30 **** | |
103 | looks for to find the patch level (for the sccs version string). */ | |
104 | ||
105 | ! #define PATCHLEVEL 1 | |
106 | ||
107 | #endif /* _PATCHLEVEL_H_ */ | |
108 | --- 26,30 ---- | |
109 | looks for to find the patch level (for the sccs version string). */ | |
110 | ||
111 | ! #define PATCHLEVEL 2 | |
112 | ||
113 | #endif /* _PATCHLEVEL_H_ */ |