commit bash-20121214 snapshot

This commit is contained in:
Chet Ramey
2013-01-03 10:46:55 -05:00
parent 8b20235af7
commit 77b3aacbdf
29 changed files with 44317 additions and 5803 deletions
+12 -3
View File
@@ -224,6 +224,10 @@ int last_command_exit_value;
was terminated by a signal, and, if so, which one. */
int last_command_exit_signal;
/* Are we currently ignoring the -e option for the duration of a builtin's
execution? */
int builtin_ignoring_errexit = 0;
/* The list of redirections to perform which will undo the redirections
that I made in the shell. */
REDIRECT *redirection_undo_list = (REDIRECT *)NULL;
@@ -2160,7 +2164,7 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
int pipe_in, pipe_out;
struct fd_bitmap *fds_to_close;
{
int rpipe[2], wpipe[2], estat;
int rpipe[2], wpipe[2], estat, invert;
pid_t coproc_pid;
Coproc *cp;
char *tcmd;
@@ -2173,6 +2177,7 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
coproc_init (&sh_coproc);
#endif
invert = (command->flags & CMD_INVERT_RETURN) != 0;
command_string_index = 0;
tcmd = make_command_string (command);
@@ -2224,7 +2229,7 @@ execute_coproc (command, pipe_in, pipe_out, fds_to_close)
DESCRIBE_PID (coproc_pid);
run_pending_traps ();
return (EXECUTION_SUCCESS);
return (invert ? EXECUTION_FAILURE : EXECUTION_SUCCESS);
}
#endif
@@ -4219,6 +4224,7 @@ execute_builtin (builtin, words, flags, subshell)
error_trap = 0;
old_e_flag = exit_immediately_on_error;
/* The eval builtin calls parse_and_execute, which does not know about
the setting of flags, and always calls the execution functions with
flags that will exit the shell on an error if -e is set. If the
@@ -4231,6 +4237,7 @@ execute_builtin (builtin, words, flags, subshell)
{
begin_unwind_frame ("eval_builtin");
unwind_protect_int (exit_immediately_on_error);
unwind_protect_int (builtin_ignoring_errexit);
error_trap = TRAP_STRING (ERROR_TRAP);
if (error_trap)
{
@@ -4240,6 +4247,7 @@ execute_builtin (builtin, words, flags, subshell)
restore_default_signal (ERROR_TRAP);
}
exit_immediately_on_error = 0;
builtin_ignoring_errexit = 1;
eval_unwind = 1;
}
else
@@ -4289,7 +4297,8 @@ execute_builtin (builtin, words, flags, subshell)
if (eval_unwind)
{
exit_immediately_on_error += old_e_flag;
exit_immediately_on_error = errexit_flag;
builtin_ignoring_errexit = 0;
if (error_trap)
{
set_error_trap (error_trap);