- fix errexit logic to not cause the shell to exit when a command in
a pipeline fails. Fixes bug reported by Marcin Owsiany
<marcin@owsiany.pl>
+
+ 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
+ <s-kiess@web.de>
----
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
+ <marcin@owsiany.pl>
* 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
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))
{
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;
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);
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))
{
code = should_jump_to_top_level = 0;
oglobal = global_command;
+ ostring = string;
with_input_from_string (string, from_file);
while (*(bash_input.location.string))
@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
@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
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.