From: Chet Ramey Date: Fri, 1 Jun 2018 14:22:36 +0000 (-0400) Subject: fix for SIGINT in sourced script X-Git-Tag: bash-5.0~1 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fbash.git;a=commitdiff_plain;h=64447609994bfddeef1061948022c074093e9a9f fix for SIGINT in sourced script --- diff --git a/builtins/trap.def b/builtins/trap.def index 57d9b5227..d43b0ef66 100644 --- a/builtins/trap.def +++ b/builtins/trap.def @@ -98,6 +98,7 @@ static int display_traps __P((WORD_LIST *)); #define IGNORE 2 /* Ignore this signal. */ extern int posixly_correct, subshell_environment; +extern int sourcelevel, running_trap; int trap_builtin (list) @@ -212,6 +213,9 @@ trap_builtin (list) was SIG_IGN? */ if (interactive) set_signal_handler (SIGINT, sigint_sighandler); + /* special cases for interactive == 0 */ + else if (interactive_shell && (sourcelevel||running_trap)) + set_signal_handler (SIGINT, sigint_sighandler); else set_signal_handler (SIGINT, termsig_sighandler); break; diff --git a/patchlevel.h b/patchlevel.h index 9be226c36..2060b58fe 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 22 +#define PATCHLEVEL 23 #endif /* _PATCHLEVEL_H_ */