diff options
author | Chet Ramey <chet.ramey@case.edu> | 2022-12-13 12:43:50 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2022-12-13 12:43:50 -0500 |
commit | ec8113b9861375e4e17b3307372569d429dec814 (patch) | |
tree | eda6c9c211d8db4f1ec80d1ec4095d5d96abfe5a /builtins | |
parent | 6647917a43dd987c5564cc20d0943213b39e748b (diff) | |
download | bash-master.tar.gz |
Diffstat (limited to 'builtins')
-rw-r--r-- | builtins/common.h | 1 | ||||
-rw-r--r-- | builtins/eval.def | 2 | ||||
-rw-r--r-- | builtins/evalstring.c | 9 |
3 files changed, 8 insertions, 4 deletions
diff --git a/builtins/common.h b/builtins/common.h index 726bd91f..a170f8fc 100644 --- a/builtins/common.h +++ b/builtins/common.h @@ -51,6 +51,7 @@ do { \ #define SEVAL_FUNCDEF 0x080 /* only allow function definitions */ #define SEVAL_ONECMD 0x100 /* only allow a single command */ #define SEVAL_NOHISTEXP 0x200 /* inhibit history expansion */ +#define SEVAL_NOOPTIMIZE 0x400 /* don't try to set optimization flags */ /* Flags for describe_command, shared between type.def and command.def */ #define CDESC_ALL 0x001 /* type -a */ diff --git a/builtins/eval.def b/builtins/eval.def index a92b538f..f459bce3 100644 --- a/builtins/eval.def +++ b/builtins/eval.def @@ -53,5 +53,5 @@ eval_builtin (list) return (EX_USAGE); list = loptend; /* skip over possible `--' */ - return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST) : EXECUTION_SUCCESS); + return (list ? evalstring (string_list (list), "eval", SEVAL_NOHIST|SEVAL_NOOPTIMIZE) : EXECUTION_SUCCESS); } diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 264a836b..df3dd68e 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -132,8 +132,8 @@ optimize_connection_fork (command) if (command->type == cm_connection && (command->value.Connection->connector == AND_AND || command->value.Connection->connector == OR_OR || command->value.Connection->connector == ';') && (command->value.Connection->second->flags & CMD_TRY_OPTIMIZING) && - ((startup_state == 2 && should_suppress_fork (command->value.Connection->second)) || - ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0)))) + (should_suppress_fork (command->value.Connection->second) || + ((subshell_environment & SUBSHELL_PAREN) && should_optimize_fork (command->value.Connection->second, 0)))) { command->value.Connection->second->flags |= CMD_NO_FORK; command->value.Connection->second->value.Simple->flags |= CMD_NO_FORK; @@ -290,6 +290,7 @@ parse_prologue (string, flags, tag) (flags & SEVAL_NOFREE) -> don't free STRING when finished (flags & SEVAL_RESETLINE) -> reset line_number to 1 (flags & SEVAL_NOHISTEXP) -> history_expansion_inhibited -> 1 + (flags & SEVAL_NOOPTIMIZE) -> don't try to turn on optimizing flags */ int @@ -502,7 +503,9 @@ parse_and_execute (string, from_file, flags) if we are at the end of the command string, the last in a series of connection commands is command->value.Connection->second. */ - else if (command->type == cm_connection && can_optimize_connection (command)) + else if (command->type == cm_connection && + (flags & SEVAL_NOOPTIMIZE) == 0 && + can_optimize_connection (command)) { command->value.Connection->second->flags |= CMD_TRY_OPTIMIZING; command->value.Connection->second->value.Simple->flags |= CMD_TRY_OPTIMIZING; |