Bash-5.0 patch 15: aliases and -c commands can cause premature termination

This commit is contained in:
Chet Ramey 2020-02-07 15:19:53 -05:00
parent 8b6524c482
commit ad1b3e6822
2 changed files with 5 additions and 3 deletions

View File

@ -91,6 +91,7 @@ should_suppress_fork (command)
return (startup_state == 2 && parse_and_execute_level == 1 && return (startup_state == 2 && parse_and_execute_level == 1 &&
running_trap == 0 && running_trap == 0 &&
*bash_input.location.string == '\0' && *bash_input.location.string == '\0' &&
parser_expanding_alias () == 0 &&
command->type == cm_simple && command->type == cm_simple &&
signal_is_trapped (EXIT_TRAP) == 0 && signal_is_trapped (EXIT_TRAP) == 0 &&
signal_is_trapped (ERROR_TRAP) == 0 && signal_is_trapped (ERROR_TRAP) == 0 &&
@ -105,6 +106,7 @@ can_optimize_connection (command)
COMMAND *command; COMMAND *command;
{ {
return (*bash_input.location.string == '\0' && return (*bash_input.location.string == '\0' &&
parser_expanding_alias () == 0 &&
(command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') && (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') &&
command->value.Connection->second->type == cm_simple); command->value.Connection->second->type == cm_simple);
} }
@ -290,7 +292,7 @@ parse_and_execute (string, from_file, flags)
with_input_from_string (string, from_file); with_input_from_string (string, from_file);
clear_shell_input_line (); clear_shell_input_line ();
while (*(bash_input.location.string)) while (*(bash_input.location.string) || parser_expanding_alias ())
{ {
command = (COMMAND *)NULL; command = (COMMAND *)NULL;
@ -545,7 +547,7 @@ parse_string (string, from_file, flags, endp)
ostring = string; ostring = string;
with_input_from_string (string, from_file); with_input_from_string (string, from_file);
while (*(bash_input.location.string)) while (*(bash_input.location.string)) /* XXX - parser_expanding_alias () ? */
{ {
command = (COMMAND *)NULL; command = (COMMAND *)NULL;

View File

@ -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 14 #define PATCHLEVEL 15
#endif /* _PATCHLEVEL_H_ */ #endif /* _PATCHLEVEL_H_ */