File tree 4 files changed +10
-3
lines changed
4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -2557,12 +2557,14 @@ next_alias_char:
2557
2557
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE &&
2558
2558
pushed_string_list->flags != PSH_DPAREN &&
2559
2559
(parser_state & PST_COMMENT) == 0 &&
2560
+ (parser_state & PST_ENDALIAS) == 0 && /* only once */
2560
2561
shell_input_line_index > 0 &&
2561
- shell_input_line[shell_input_line_index-1 ] != ' ' &&
2562
+ shellblank ( shell_input_line[shell_input_line_index-1 ]) == 0 &&
2562
2563
shell_input_line[shell_input_line_index-1 ] != ' \n ' &&
2563
2564
shellmeta (shell_input_line[shell_input_line_index-1 ]) == 0 &&
2564
2565
(current_delimiter (dstack) != ' \' ' && current_delimiter (dstack) != ' "' ))
2565
2566
{
2567
+ parser_state |= PST_ENDALIAS;
2566
2568
return ' ' ; /* END_ALIAS */
2567
2569
}
2568
2570
#endif
@@ -2571,6 +2573,7 @@ pop_alias:
2571
2573
/* This case works for PSH_DPAREN as well */
2572
2574
if (uc == 0 && pushed_string_list && pushed_string_list->flags != PSH_SOURCE)
2573
2575
{
2576
+ parser_state &= ~PST_ENDALIAS;
2574
2577
pop_string ();
2575
2578
uc = shell_input_line[shell_input_line_index];
2576
2579
if (uc)
Original file line number Diff line number Diff line change 47
47
#define PST_REPARSE 0x040000 /* re-parsing in parse_string_to_word_list */
48
48
#define PST_REDIRLIST 0x080000 /* parsing a list of redirections preceding a simple command name */
49
49
#define PST_COMMENT 0x100000 /* parsing a shell comment; used by aliases */
50
+ #define PST_ENDALIAS 0x200000 /* just finished expanding and consuming an alias */
50
51
51
52
/* Definition of the delimiter stack. Needed by parse.y and bashhist.c. */
52
53
struct dstack {
Original file line number Diff line number Diff line change 25
25
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
26
26
looks for to find the patch level (for the sccs version string). */
27
27
28
- #define PATCHLEVEL 1
28
+ #define PATCHLEVEL 2
29
29
30
30
#endif /* _PATCHLEVEL_H_ */
Original file line number Diff line number Diff line change @@ -4873,12 +4873,14 @@ shell_getc (remove_quoted_newline)
4873
4873
if (uc == 0 && pushed_string_list && pushed_string_list -> flags != PSH_SOURCE &&
4874
4874
pushed_string_list -> flags != PSH_DPAREN &&
4875
4875
(parser_state & PST_COMMENT ) == 0 &&
4876
+ (parser_state & PST_ENDALIAS ) == 0 && /* only once */
4876
4877
shell_input_line_index > 0 &&
4877
- shell_input_line [shell_input_line_index - 1 ] != ' ' &&
4878
+ shellblank ( shell_input_line [shell_input_line_index - 1 ]) == 0 &&
4878
4879
shell_input_line [shell_input_line_index - 1 ] != '\n' &&
4879
4880
shellmeta (shell_input_line [shell_input_line_index - 1 ]) == 0 &&
4880
4881
(current_delimiter (dstack ) != '\'' && current_delimiter (dstack ) != '"' ))
4881
4882
{
4883
+ parser_state |= PST_ENDALIAS ;
4882
4884
return ' ' ; /* END_ALIAS */
4883
4885
}
4884
4886
#endif
@@ -4887,6 +4889,7 @@ shell_getc (remove_quoted_newline)
4887
4889
/* This case works for PSH_DPAREN as well */
4888
4890
if (uc == 0 && pushed_string_list && pushed_string_list -> flags != PSH_SOURCE )
4889
4891
{
4892
+ parser_state &= ~PST_ENDALIAS ;
4890
4893
pop_string ();
4891
4894
uc = shell_input_line [shell_input_line_index ];
4892
4895
if (uc )
You can’t perform that action at this time.
0 commit comments