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
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.
17 Patch (apply with `patch -p0'):
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
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 */
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
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) != '"'))
41 return ' '; /* END_ALIAS */
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) != '"'))
53 + parser_state |= PST_ENDALIAS;
54 return ' '; /* END_ALIAS */
59 if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
61 + parser_state &= ~PST_ENDALIAS;
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
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) != '"'))
76 return ' '; /* END_ALIAS */
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) != '"'))
88 + parser_state |= PST_ENDALIAS;
89 return ' '; /* END_ALIAS */
94 if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
96 + parser_state &= ~PST_ENDALIAS;
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
103 looks for to find the patch level (for the sccs version string). */
105 ! #define PATCHLEVEL 1
107 #endif /* _PATCHLEVEL_H_ */
109 looks for to find the patch level (for the sccs version string). */
111 ! #define PATCHLEVEL 2
113 #endif /* _PATCHLEVEL_H_ */