From 3abf178f91c942a6b8fbab5b81374ed29d5108f7 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Wed, 7 Dec 2011 09:30:10 -0500 Subject: [PATCH] commit bash-20081009 snapshot --- CWRU/CWRU.chlog | 7 +++++++ CWRU/CWRU.chlog~ | 3 ++- builtins/evalstring.c | 4 +++- builtins/evalstring.c~ | 6 +++++- doc/bashref.texi | 8 +++++--- doc/bashref.texi~ | 4 ++-- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 9a02993e7..c374509c3 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -7026,3 +7026,10 @@ execute_cmd.c - fix errexit logic to not cause the shell to exit when a command in a pipeline fails. Fixes bug reported by Marcin Owsiany + + 10/14 + ----- +builtins/evalstring.c + - don't short-circuit execution in parse_and_execute if we want to + run an exit trap. Fixes bug reported by Steffen Kiess + diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~ index 4b25664c1..9a02993e7 100644 --- a/CWRU/CWRU.chlog~ +++ b/CWRU/CWRU.chlog~ @@ -7024,4 +7024,5 @@ lib/readline/doc/rltech.texi ---- execute_cmd.c - fix errexit logic to not cause the shell to exit when a command in - a pipeline fails + a pipeline fails. Fixes bug reported by Marcin Owsiany + diff --git a/builtins/evalstring.c b/builtins/evalstring.c index 657c98d13..13523c0f1 100644 --- a/builtins/evalstring.c +++ b/builtins/evalstring.c @@ -266,6 +266,7 @@ parse_and_execute (string, from_file, flags) * parse_and_execute has not been called recursively AND * we're not running a trap AND * we have parsed the full command (string == '\0') AND + * we're not going to run the exit trap AND * we have a simple command without redirections AND * the command is not being timed AND * the command's return status is not being inverted @@ -276,7 +277,8 @@ parse_and_execute (string, from_file, flags) running_trap == 0 && *bash_input.location.string == '\0' && command->type == cm_simple && - !command->redirects && !command->value.Simple->redirects && + signal_is_trapped (EXIT_TRAP) == 0 && + command->redirects == 0 && command->value.Simple->redirects == 0 && ((command->flags & CMD_TIME_PIPELINE) == 0) && ((command->flags & CMD_INVERT_RETURN) == 0)) { diff --git a/builtins/evalstring.c~ b/builtins/evalstring.c~ index e828880b3..419f1432e 100644 --- a/builtins/evalstring.c~ +++ b/builtins/evalstring.c~ @@ -64,6 +64,7 @@ extern int current_token, shell_eof_token; extern int last_command_exit_value; extern int running_trap; extern int loop_level; +extern int executing_list; extern int posixly_correct; int parse_and_execute_level = 0; @@ -110,6 +111,7 @@ parse_prologue (string, flags, tag) unwind_protect_int (indirection_level); unwind_protect_int (line_number); unwind_protect_int (loop_level); + unwind_protect_int (executing_list); if (flags & (SEVAL_NONINT|SEVAL_INTERACT)) unwind_protect_int (interactive); @@ -274,7 +276,8 @@ parse_and_execute (string, from_file, flags) running_trap == 0 && *bash_input.location.string == '\0' && command->type == cm_simple && - !command->redirects && !command->value.Simple->redirects && + signal_is_trapped (EXIT_TRAP) == 0 && + command->redirects == 0 && command->value.Simple->redirects == 0 && ((command->flags & CMD_TIME_PIPELINE) == 0) && ((command->flags & CMD_INVERT_RETURN) == 0)) { @@ -363,6 +366,7 @@ parse_string (string, from_file, flags, endp) code = should_jump_to_top_level = 0; oglobal = global_command; + ostring = string; with_input_from_string (string, from_file); while (*(bash_input.location.string)) diff --git a/doc/bashref.texi b/doc/bashref.texi index 2e37ff11e..3bffbb042 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -275,6 +275,7 @@ Also referred to as an @code{identifier}. @cindex operator, shell A @code{control operator} or a @code{redirection operator}. @xref{Redirections}, for a list of redirection operators. +Operators contain at least one unquoted @code{metacharacter}. @item process group @cindex process group @@ -308,12 +309,13 @@ A shell builtin command that has been classified as special by the @item token @cindex token -A sequence of characters considered a single unit by the shell. It is -either a @code{word} or an @code{operator}. +A sequence of characters considered a single unit by the shell. +It is either a @code{word} or an @code{operator}. @item word @cindex word -A @code{token} that is not an @code{operator}. +A sequence of characters treated as a unit by the shell. +Words may not include unquoted @code{metacharacters}. @end table @node Basic Shell Features diff --git a/doc/bashref.texi~ b/doc/bashref.texi~ index 28d5ac33f..2e37ff11e 100644 --- a/doc/bashref.texi~ +++ b/doc/bashref.texi~ @@ -4090,8 +4090,8 @@ Same as @code{-x}. Turn on privileged mode. In this mode, the @env{$BASH_ENV} and @env{$ENV} files are not processed, shell functions are not inherited from the environment, -and the @env{SHELLOPTS} variable, if it appears in the environment, -is ignored. +and the @env{SHELLOPTS}, @env{CDPATH} and @env{GLOBIGNORE} variables, +if they appear in the environment, are ignored. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the @code{-p} option is not supplied, these actions are taken and the effective user id is set to the real user id. -- 2.47.2