Stop expanding globs in command position when performing error checking

Before running a command, or before importing a command from bash history,
we perform error checking. As part of error checking we expand commands
including variables and globs. If the glob is very large, like `/**`, then
we could hang expanding it.

One fix would be to limit the amount of expansion from the glob, but
instead let's just not expand command globs when performing error checking.

Fixes #7407
This commit is contained in:
ridiculousfish
2020-12-20 13:36:12 -08:00
parent a8080e8e6f
commit e43913a547
5 changed files with 16 additions and 7 deletions

View File

@@ -1136,7 +1136,8 @@ static bool detect_errors_in_decorated_statement(const wcstring &buff_src,
wcstring command;
// Check that we can expand the command.
if (expand_to_command_and_args(unexp_command, operation_context_t::empty(), &command,
nullptr, parse_errors) == expand_result_t::error) {
nullptr, parse_errors,
true /* skip wildcards */) == expand_result_t::error) {
errored = true;
parse_error_offset_source_start(parse_errors, source_start);
}