mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-07 02:32:27 +02:00
Bash-5.2 patch 34: fix for parsing compound assignment while expanding alias
This commit is contained in:
-1326
File diff suppressed because it is too large
Load Diff
-23305
File diff suppressed because it is too large
Load Diff
@@ -6489,9 +6489,10 @@ parse_compound_assignment (retlenp)
|
|||||||
int *retlenp;
|
int *retlenp;
|
||||||
{
|
{
|
||||||
WORD_LIST *wl, *rl;
|
WORD_LIST *wl, *rl;
|
||||||
int tok, orig_line_number, assignok;
|
int tok, orig_line_number, assignok, ea, restore_pushed_strings;
|
||||||
sh_parser_state_t ps;
|
sh_parser_state_t ps;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
STRING_SAVER *ss;
|
||||||
|
|
||||||
orig_line_number = line_number;
|
orig_line_number = line_number;
|
||||||
save_parser_state (&ps);
|
save_parser_state (&ps);
|
||||||
@@ -6514,6 +6515,12 @@ parse_compound_assignment (retlenp)
|
|||||||
|
|
||||||
esacs_needed_count = expecting_in_token = 0;
|
esacs_needed_count = expecting_in_token = 0;
|
||||||
|
|
||||||
|
/* We're not pushing any new input here, we're reading from the current input
|
||||||
|
source. If that's an alias, we have to be prepared for the alias to get
|
||||||
|
popped out from underneath us. */
|
||||||
|
ss = (ea = expanding_alias ()) ? pushed_string_list : (STRING_SAVER *)NULL;
|
||||||
|
restore_pushed_strings = 0;
|
||||||
|
|
||||||
while ((tok = read_token (READ)) != ')')
|
while ((tok = read_token (READ)) != ')')
|
||||||
{
|
{
|
||||||
if (tok == '\n') /* Allow newlines in compound assignments */
|
if (tok == '\n') /* Allow newlines in compound assignments */
|
||||||
@@ -6537,7 +6544,16 @@ parse_compound_assignment (retlenp)
|
|||||||
wl = make_word_list (yylval.word, wl);
|
wl = make_word_list (yylval.word, wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check whether or not an alias got popped out from underneath us and
|
||||||
|
fix up after restore_parser_state. */
|
||||||
|
if (ea && ss && ss != pushed_string_list)
|
||||||
|
{
|
||||||
|
restore_pushed_strings = 1;
|
||||||
|
ss = pushed_string_list;
|
||||||
|
}
|
||||||
restore_parser_state (&ps);
|
restore_parser_state (&ps);
|
||||||
|
if (restore_pushed_strings)
|
||||||
|
pushed_string_list = ss;
|
||||||
|
|
||||||
if (wl == &parse_string_error)
|
if (wl == &parse_string_error)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -25,6 +25,6 @@
|
|||||||
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
|
||||||
looks for to find the patch level (for the sccs version string). */
|
looks for to find the patch level (for the sccs version string). */
|
||||||
|
|
||||||
#define PATCHLEVEL 33
|
#define PATCHLEVEL 34
|
||||||
|
|
||||||
#endif /* _PATCHLEVEL_H_ */
|
#endif /* _PATCHLEVEL_H_ */
|
||||||
|
|||||||
@@ -8804,9 +8804,10 @@ parse_compound_assignment (retlenp)
|
|||||||
int *retlenp;
|
int *retlenp;
|
||||||
{
|
{
|
||||||
WORD_LIST *wl, *rl;
|
WORD_LIST *wl, *rl;
|
||||||
int tok, orig_line_number, assignok;
|
int tok, orig_line_number, assignok, ea, restore_pushed_strings;
|
||||||
sh_parser_state_t ps;
|
sh_parser_state_t ps;
|
||||||
char *ret;
|
char *ret;
|
||||||
|
STRING_SAVER *ss;
|
||||||
|
|
||||||
orig_line_number = line_number;
|
orig_line_number = line_number;
|
||||||
save_parser_state (&ps);
|
save_parser_state (&ps);
|
||||||
@@ -8829,6 +8830,12 @@ parse_compound_assignment (retlenp)
|
|||||||
|
|
||||||
esacs_needed_count = expecting_in_token = 0;
|
esacs_needed_count = expecting_in_token = 0;
|
||||||
|
|
||||||
|
/* We're not pushing any new input here, we're reading from the current input
|
||||||
|
source. If that's an alias, we have to be prepared for the alias to get
|
||||||
|
popped out from underneath us. */
|
||||||
|
ss = (ea = expanding_alias ()) ? pushed_string_list : (STRING_SAVER *)NULL;
|
||||||
|
restore_pushed_strings = 0;
|
||||||
|
|
||||||
while ((tok = read_token (READ)) != ')')
|
while ((tok = read_token (READ)) != ')')
|
||||||
{
|
{
|
||||||
if (tok == '\n') /* Allow newlines in compound assignments */
|
if (tok == '\n') /* Allow newlines in compound assignments */
|
||||||
@@ -8852,7 +8859,16 @@ parse_compound_assignment (retlenp)
|
|||||||
wl = make_word_list (yylval.word, wl);
|
wl = make_word_list (yylval.word, wl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check whether or not an alias got popped out from underneath us and
|
||||||
|
fix up after restore_parser_state. */
|
||||||
|
if (ea && ss && ss != pushed_string_list)
|
||||||
|
{
|
||||||
|
restore_pushed_strings = 1;
|
||||||
|
ss = pushed_string_list;
|
||||||
|
}
|
||||||
restore_parser_state (&ps);
|
restore_parser_state (&ps);
|
||||||
|
if (restore_pushed_strings)
|
||||||
|
pushed_string_list = ss;
|
||||||
|
|
||||||
if (wl == &parse_string_error)
|
if (wl == &parse_string_error)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user