mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 00:19:51 +02:00
fix to trap execution to avoid the shell believing it's still executing the handler after returning
This commit is contained in:
@@ -444,7 +444,7 @@ z. The new `--enable-translatable-strings' option to `configure' allows $"..."
|
||||
support to be compiled in or out.
|
||||
|
||||
aa. The new `globskipdots' shell option forces pathname expansion never to
|
||||
return `.' or `..' unless explicitly matched.
|
||||
return `.' or `..' unless explicitly matched. It is enabled by default.
|
||||
|
||||
bb. Array references using `@' and `*' that are the value of nameref variables
|
||||
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
|
||||
|
||||
+1
-1
@@ -444,7 +444,7 @@ z. The new `--enable-translatable-strings' option to `configure' allows $"..."
|
||||
support to be compiled in or out.
|
||||
|
||||
aa. The new `globskipdots' shell option forces pathname expansion never to
|
||||
return `.' or `..' unless explicitly matched.
|
||||
return `.' or `..' unless explicitly matched. It is enabled by default.
|
||||
|
||||
bb. Array references using `@' and `*' that are the value of nameref variables
|
||||
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
|
||||
|
||||
@@ -3845,3 +3845,16 @@ parse.y
|
||||
so parse errors can be caught before forking a child for command
|
||||
substitution, as part of word expansion, but after extglob may have
|
||||
been set by command execution (e.g., in a shell function)
|
||||
|
||||
8/5
|
||||
---
|
||||
[bump version to bash-5.2-rc3]
|
||||
|
||||
8/6
|
||||
---
|
||||
trap.c
|
||||
- run_pending_traps: move code from evalstring() so we call
|
||||
parse_and_execute() directly and handle any `return' invocations so
|
||||
we can restore the value of running_trap. Otherwise, if we longjmp
|
||||
past this function, we will think we're running a trap after we
|
||||
finish. Prompted by post from Koichi Murase <myoga.murase@gmail.com>
|
||||
|
||||
@@ -94,7 +94,7 @@ z. The new `--enable-translatable-strings' option to `configure' allows $"..."
|
||||
support to be compiled in or out.
|
||||
|
||||
aa. The new `globskipdots' shell option forces pathname expansion never to
|
||||
return `.' or `..' unless explicitly matched.
|
||||
return `.' or `..' unless explicitly matched. It is enabled by default.
|
||||
|
||||
bb. Array references using `@' and `*' that are the value of nameref variables
|
||||
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
|
||||
|
||||
@@ -94,7 +94,7 @@ z. The new `--enable-translatable-strings' option to `configure' allows $"..."
|
||||
support to be compiled in or out.
|
||||
|
||||
aa. The new `globskipdots' shell option forces pathname expansion never to
|
||||
return `.' or `..' unless explicitly matched.
|
||||
return `.' or `..' unless explicitly matched. It is enabled by default.
|
||||
|
||||
bb. Array references using `@' and `*' that are the value of nameref variables
|
||||
(declare -n ref='v[@]' ; echo $ref) no longer cause the shell to exit if
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#! /bin/sh
|
||||
# From configure.ac for Bash 5.2, version 5.043.
|
||||
# From configure.ac for Bash 5.2, version 5.044.
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.71 for bash 5.2-rc2.
|
||||
# Generated by GNU Autoconf 2.71 for bash 5.2-rc3.
|
||||
#
|
||||
# Report bugs to <bug-bash@gnu.org>.
|
||||
#
|
||||
@@ -612,8 +612,8 @@ MAKEFLAGS=
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='bash'
|
||||
PACKAGE_TARNAME='bash'
|
||||
PACKAGE_VERSION='5.2-rc2'
|
||||
PACKAGE_STRING='bash 5.2-rc2'
|
||||
PACKAGE_VERSION='5.2-rc3'
|
||||
PACKAGE_STRING='bash 5.2-rc3'
|
||||
PACKAGE_BUGREPORT='bug-bash@gnu.org'
|
||||
PACKAGE_URL=''
|
||||
|
||||
@@ -1467,7 +1467,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures bash 5.2-rc2 to adapt to many kinds of systems.
|
||||
\`configure' configures bash 5.2-rc3 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1533,7 +1533,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of bash 5.2-rc2:";;
|
||||
short | recursive ) echo "Configuration of bash 5.2-rc3:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1740,7 +1740,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
bash configure 5.2-rc2
|
||||
bash configure 5.2-rc3
|
||||
generated by GNU Autoconf 2.71
|
||||
|
||||
Copyright (C) 2021 Free Software Foundation, Inc.
|
||||
@@ -2397,7 +2397,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by bash $as_me 5.2-rc2, which was
|
||||
It was created by bash $as_me 5.2-rc3, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
$ $0$ac_configure_args_raw
|
||||
@@ -3176,7 +3176,7 @@ ac_config_headers="$ac_config_headers config.h"
|
||||
|
||||
|
||||
BASHVERS=5.2
|
||||
RELSTATUS=rc2
|
||||
RELSTATUS=rc3
|
||||
|
||||
case "$RELSTATUS" in
|
||||
alp*|bet*|dev*|rc*|releng*|maint*) DEBUG='-DDEBUG' MALLOC_DEBUG='-DMALLOC_DEBUG' ;;
|
||||
@@ -22369,7 +22369,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by bash $as_me 5.2-rc2, which was
|
||||
This file was extended by bash $as_me 5.2-rc3, which was
|
||||
generated by GNU Autoconf 2.71. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -22437,7 +22437,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config='$ac_cs_config_escaped'
|
||||
ac_cs_version="\\
|
||||
bash config.status 5.2-rc2
|
||||
bash config.status 5.2-rc3
|
||||
configured by $0, generated by GNU Autoconf 2.71,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
||||
+2
-2
@@ -21,10 +21,10 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
AC_REVISION([for Bash 5.2, version 5.043])dnl
|
||||
AC_REVISION([for Bash 5.2, version 5.044])dnl
|
||||
|
||||
define(bashvers, 5.2)
|
||||
define(relstatus, rc2)
|
||||
define(relstatus, rc3)
|
||||
|
||||
AC_INIT([bash], bashvers-relstatus, [bug-bash@gnu.org])
|
||||
|
||||
|
||||
@@ -297,11 +297,13 @@ void
|
||||
run_pending_traps ()
|
||||
{
|
||||
register int sig;
|
||||
int old_exit_value, x;
|
||||
int old_running;
|
||||
int x;
|
||||
volatile int old_exit_value, old_running;
|
||||
WORD_LIST *save_subst_varlist;
|
||||
HASH_TABLE *save_tempenv;
|
||||
sh_parser_state_t pstate;
|
||||
volatile int save_return_catch_flag, function_code;
|
||||
procenv_t save_return_catch;
|
||||
#if defined (ARRAY_VARS)
|
||||
ARRAY *ps;
|
||||
#endif
|
||||
@@ -341,9 +343,7 @@ run_pending_traps ()
|
||||
while (pending_traps[sig]--) instead of the if statement. */
|
||||
if (pending_traps[sig])
|
||||
{
|
||||
if (running_trap == sig+1)
|
||||
/*continue*/;
|
||||
|
||||
/* XXX - set last_command_exit_value = trap_saved_exit_value here? */
|
||||
running_trap = sig + 1;
|
||||
|
||||
if (sig == SIGINT)
|
||||
@@ -419,7 +419,6 @@ run_pending_traps ()
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XXX - should we use save_parser_state/restore_parser_state? */
|
||||
save_parser_state (&pstate);
|
||||
save_subst_varlist = subst_assign_varlist;
|
||||
subst_assign_varlist = 0;
|
||||
@@ -432,7 +431,23 @@ run_pending_traps ()
|
||||
/* XXX - set pending_traps[sig] = 0 here? */
|
||||
pending_traps[sig] = 0;
|
||||
evalnest++;
|
||||
evalstring (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
|
||||
|
||||
function_code = 0;
|
||||
save_return_catch_flag = return_catch_flag;
|
||||
if (return_catch_flag)
|
||||
{
|
||||
COPY_PROCENV (return_catch, save_return_catch);
|
||||
function_code = setjmp_nosigs (return_catch);
|
||||
}
|
||||
|
||||
if (function_code == 0)
|
||||
x = parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
|
||||
else
|
||||
{
|
||||
parse_and_execute_cleanup (sig + 1); /* XXX - could use -1 */
|
||||
x = return_catch_value;
|
||||
}
|
||||
|
||||
evalnest--;
|
||||
#if defined (JOB_CONTROL)
|
||||
restore_pipeline (1);
|
||||
@@ -441,6 +456,19 @@ run_pending_traps ()
|
||||
subst_assign_varlist = save_subst_varlist;
|
||||
restore_parser_state (&pstate);
|
||||
temporary_env = save_tempenv;
|
||||
|
||||
if (save_return_catch_flag)
|
||||
{
|
||||
return_catch_flag = save_return_catch_flag;
|
||||
return_catch_value = x;
|
||||
COPY_PROCENV (save_return_catch, return_catch);
|
||||
if (function_code)
|
||||
{
|
||||
running_trap = old_running; /* XXX */
|
||||
/* caller will set last_command_exit_value */
|
||||
sh_longjmp (return_catch, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pending_traps[sig] = 0; /* XXX - move before evalstring? */
|
||||
|
||||
Reference in New Issue
Block a user