From: Chet Ramey Date: Mon, 8 Jul 2019 18:42:24 +0000 (-0400) Subject: commit bash-20190705 snapshot X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea578790a910fcd394930de7a1933a9ee24f9119;p=thirdparty%2Fbash.git commit bash-20190705 snapshot --- diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index f9a92c466..9eaa35d50 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -6201,3 +6201,30 @@ pathexp.c - unquoted_glob_pattern_p: when in a bracket expression (open > 0), don't allow an unquoted slash as part of the bracket expression. Report from Stephane Chazelas + + 7/1 + --- +print_cmd.c + - print_function_def,named_function_string: make sure to call + PRINT_DEFERRED_HEREDOCS to finish printing any here documents and + delimiters before printing the function closing brace. Fixes bug + reported by Denis McKeon + +execute_cmd.c + - execute_command_internal: call reap_procsubs at the end of executing + a group command on systems that have /dev/fd. Fixes bug reported by + kfm@plushkava.net + + 7/3 + --- +jobs.c + - waitchld: this is in the potential SIGCHLD path, so don't call + bgp_add, which can potentially call malloc. The glibc malloc doesn't + handle that well. Report from howaboutsynergy@protonmail.com + + 7/5 + --- +builtins/bind.def + - bind_builtin: make sure return_code is >= 0 before returning it. + Fixes bug with bind -x and invalid key sequences reported by + bashbug@jonkmans.nl diff --git a/builtins/bind.def b/builtins/bind.def index 0853a2099..5290592db 100644 --- a/builtins/bind.def +++ b/builtins/bind.def @@ -287,6 +287,9 @@ bind_builtin (list) run_unwind_frame ("bind_builtin"); + if (return_code < 0) + return_code = EXECUTION_FAILURE; + return (sh_chkwrite (return_code)); } diff --git a/execute_cmd.c b/execute_cmd.c index e094bddb0..6c50d0c9a 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -781,33 +781,11 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, return (last_command_exit_value = EXECUTION_FAILURE); } -#if 0 - if (redirection_undo_list) - { - /* XXX - why copy here? */ - my_undo_list = (REDIRECT *)copy_redirects (redirection_undo_list); - dispose_partial_redirects (); - } - else - my_undo_list = (REDIRECT *)NULL; -#else my_undo_list = redirection_undo_list; redirection_undo_list = (REDIRECT *)NULL; -#endif -#if 0 - if (exec_redirection_undo_list) - { - /* XXX - why copy here? */ - exec_undo_list = (REDIRECT *)copy_redirects (exec_redirection_undo_list); - dispose_exec_redirects (); - } - else - exec_undo_list = (REDIRECT *)NULL; -#else exec_undo_list = exec_redirection_undo_list; exec_redirection_undo_list = (REDIRECT *)NULL; -#endif if (my_undo_list || exec_undo_list) begin_unwind_frame ("loop_redirections"); @@ -1113,6 +1091,7 @@ execute_command_internal (command, asynchronous, pipe_in, pipe_out, case cm_while: case cm_until: case cm_for: + case cm_group: # if defined (ARITH_FOR_COMMAND) case cm_arith_for: # endif @@ -2715,7 +2694,14 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close) } executing_list++; QUIT; +#if 1 execute_command (command->value.Connection->first); +#else + execute_command_internal (command->value.Connection->first, + asynchronous, pipe_in, pipe_out, + fds_to_close); +#endif + QUIT; optimize_fork (command); /* XXX */ exec_result = execute_command_internal (command->value.Connection->second, @@ -2779,7 +2765,11 @@ execute_connection (command, asynchronous, pipe_in, pipe_out, fds_to_close) if (command->value.Connection->first) command->value.Connection->first->flags |= CMD_IGNORE_RETURN; +#if 1 exec_result = execute_command (command->value.Connection->first); +#else + exec_result = execute_command_internal (command->value.Connection->first, 0, NO_PIPE, NO_PIPE, fds_to_close); +#endif QUIT; if (((command->value.Connection->connector == AND_AND) && (exec_result == EXECUTION_SUCCESS)) || diff --git a/jobs.c b/jobs.c index d81bc238c..049bde1c8 100644 --- a/jobs.c +++ b/jobs.c @@ -3695,10 +3695,7 @@ itrace("waitchld: waitpid returns %d block = %d children_exited = %d", pid, bloc /* Only manipulate the list of process substitutions while SIGCHLD is blocked. */ if ((ind = find_procsub_child (pid)) >= 0) - { - set_procsub_status (ind, pid, WSTATUS (status)); - bgp_add (pid, WSTATUS (status)); - } + set_procsub_status (ind, pid, WSTATUS (status)); #endif /* It is not an error to have a child terminate that we did diff --git a/print_cmd.c b/print_cmd.c index 9aa6557dd..c392f320a 100644 --- a/print_cmd.c +++ b/print_cmd.c @@ -1312,7 +1312,7 @@ print_function_def (func) make_command_string_internal (cmdcopy->type == cm_group ? cmdcopy->value.Group->command : cmdcopy); - /* XXX - PRINT_DEFERRED_HEREDOCS (""); ? */ + PRINT_DEFERRED_HEREDOCS (""); remove_unwind_protect (); indentation -= indentation_amount; @@ -1388,7 +1388,7 @@ named_function_string (name, command, flags) make_command_string_internal (cmdcopy->type == cm_group ? cmdcopy->value.Group->command : cmdcopy); - /* XXX - PRINT_DEFERRED_HEREDOCS (""); ? */ + PRINT_DEFERRED_HEREDOCS (""); indentation = old_indent; indentation_amount = old_amount; diff --git a/subst.c b/subst.c index 3a70d725c..ac3f61bad 100644 --- a/subst.c +++ b/subst.c @@ -5515,6 +5515,7 @@ wait_procsubs () if (fifo_list[i].proc != (pid_t)-1 && fifo_list[i].proc > 0) { r = wait_for (fifo_list[i].proc); + /* add to bgpids list? have to make interface public */ fifo_list[i].proc = (pid_t)-1; } } @@ -5748,6 +5749,7 @@ wait_procsubs () if (dev_fd_list[i] != (pid_t)-1 && dev_fd_list[i] > 0) { r = wait_for (dev_fd_list[i]); + /* add to bgpids list? have to make interface public */ dev_fd_list[i] = (pid_t)-1; } } diff --git a/tests/glob.right b/tests/glob.right index 124338419..df576cc9c 100644 --- a/tests/glob.right +++ b/tests/glob.right @@ -91,6 +91,24 @@ argv[1] = <./tmp/> argv[1] = <\$foo> argv[2] = <\$foo> argv[1] = + +<.> +*abc.c +searchable/. +searchable/./. +readable/\. +readable/\./. +searchable/\. +readable/\. +searchable/. +searchable/. +searchable/. +1: [qwe/qwe] +2: [qwe/ +3: [qwe/] +4: +5: [qwe/ +6: argv[1] = argv[2] = argv[3] = @@ -105,7 +123,7 @@ argv[2] = argv[3] = argv[4] = tmp/l1 tmp/l2 tmp/*4 tmp/l3 -./glob.tests: line 48: no match: tmp/*4 +./glob.tests: line 50: no match: tmp/*4 argv[1] = argv[1] = <*> argv[1] =