commit bash-20140619 snapshot

This commit is contained in:
Chet Ramey
2014-07-11 15:54:59 -04:00
parent cc38885685
commit fbbc416fc0
30 changed files with 17762 additions and 19 deletions
+26 -6
View File
@@ -848,6 +848,15 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out,
{
last_command_exit_value = exec_result;
run_pending_traps ();
#if 0 /* XXX - bash-4.4 or bash-5.0 */
/* Undo redirections before running exit trap on the way out of
set -e. Report by Mark Farrell 5/19/2014 */
if (exit_immediately_on_error && signal_is_trapped (0) &&
unwind_protect_tag_on_stack ("saved-redirects"))
run_unwind_frame ("saved-redirects");
#endif
jump_to_top_level (ERREXIT);
}
@@ -2424,7 +2433,16 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
#endif
lstdin = wait_for (lastpid);
#if defined (JOB_CONTROL)
exec_result = job_exit_status (lastpipe_jid);
/* If wait_for removes the job from the jobs table, use result of last
command as pipeline's exit status as usual. The jobs list can get
frozen and unfrozen at inconvenient times if there are multiple pipelines
running simultaneously. */
if (INVALID_JOB (lastpipe_jid) == 0)
exec_result = job_exit_status (lastpipe_jid);
else if (pipefail_opt)
exec_result = exec_result | lstdin; /* XXX */
/* otherwise we use exec_result */
#endif
unfreeze_jobs_list ();
}
@@ -4287,7 +4305,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
@@ -4589,7 +4607,7 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
unlink_fifo_list ();
#endif
}
return (result);
}
@@ -4765,7 +4783,7 @@ execute_builtin_or_function (words, builtin, var, redirects,
if (saved_undo_list)
{
begin_unwind_frame ("saved redirects");
begin_unwind_frame ("saved-redirects");
add_unwind_protect (cleanup_redirects, (char *)saved_undo_list);
}
@@ -4801,13 +4819,13 @@ execute_builtin_or_function (words, builtin, var, redirects,
redirection_undo_list = exec_redirection_undo_list;
saved_undo_list = exec_redirection_undo_list = (REDIRECT *)NULL;
if (discard)
discard_unwind_frame ("saved redirects");
discard_unwind_frame ("saved-redirects");
}
if (saved_undo_list)
{
redirection_undo_list = saved_undo_list;
discard_unwind_frame ("saved redirects");
discard_unwind_frame ("saved-redirects");
}
if (redirection_undo_list)
@@ -5344,6 +5362,8 @@ shell_execve (command, args, env)
unbind_args (); /* remove the positional parameters */
clear_fifo_list (); /* pipe fds are what they are now */
longjmp (subshell_top_level, 1);
/*NOTREACHED*/
}