.
OBS-URL: https://build.opensuse.org/package/show/Base:System/bash?expand=0&rev=65
This commit is contained in:
parent
6767bca39d
commit
295c121a6d
@ -1,75 +1,123 @@
|
|||||||
--- config.h.in
|
--- shell.c
|
||||||
+++ config.h.in 2011-03-08 11:18:00.139925937 +0000
|
+++ shell.c 2011-03-08 17:25:55.160426342 +0000
|
||||||
@@ -530,6 +530,9 @@
|
@@ -261,6 +261,11 @@ static const struct {
|
||||||
/* Define if you have the asprintf function. */
|
{ (char *)0x0, Int, (int *)0x0, (char **)0x0 }
|
||||||
#undef HAVE_ASPRINTF
|
};
|
||||||
|
|
||||||
+/* Define if you have the ATEXIT function. */
|
+#if defined (HAVE_POSIX_SIGSETJMP)
|
||||||
+#undef HAVE_ATEXIT
|
+volatile procenv_t terminating_now;
|
||||||
|
+volatile sig_atomic_t jump_with_sig;
|
||||||
|
+#endif /* HAVE_POSIX_SIGSETJMP */
|
||||||
+
|
+
|
||||||
/* Define if you have the bcopy function. */
|
/* These are extern so execute_simple_command can set them, and then
|
||||||
#undef HAVE_BCOPY
|
longjmp back to main to execute a shell script, instead of calling
|
||||||
|
main () again and resulting in indefinite, possibly fatal, stack
|
||||||
|
@@ -379,6 +384,39 @@ main (argc, argv, env)
|
||||||
|
if (code)
|
||||||
|
exit (2);
|
||||||
|
|
||||||
--- configure
|
+#if defined (HAVE_POSIX_SIGSETJMP)
|
||||||
+++ configure 2011-03-08 11:20:57.780426177 +0000
|
+ /* Catch signals here */
|
||||||
@@ -13497,7 +13497,7 @@ done
|
+ if (sigsetjmp (terminating_now, 1))
|
||||||
|
+ {
|
||||||
|
+ int sig = jump_with_sig;
|
||||||
|
+
|
||||||
|
+ /* I don't believe this condition ever tests true. */
|
||||||
|
+ if (sig == SIGINT && signal_is_trapped (SIGINT))
|
||||||
|
+ run_interrupt_trap ();
|
||||||
|
+
|
||||||
|
+# if defined (HISTORY)
|
||||||
|
+ if (interactive_shell && sig != SIGABRT)
|
||||||
|
+ maybe_save_shell_history ();
|
||||||
|
+# endif /* HISTORY */
|
||||||
|
+
|
||||||
|
+# if defined (JOB_CONTROL)
|
||||||
|
+ if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
|
||||||
|
+ hangup_all_jobs ();
|
||||||
|
+ end_job_control ();
|
||||||
|
+# endif /* JOB_CONTROL */
|
||||||
|
+
|
||||||
|
+# if defined (PROCESS_SUBSTITUTION)
|
||||||
|
+ unlink_fifo_list ();
|
||||||
|
+# endif /* PROCESS_SUBSTITUTION */
|
||||||
|
+
|
||||||
|
+ run_exit_trap ();
|
||||||
|
+ set_signal_handler (sig, SIG_DFL);
|
||||||
|
+ kill (getpid (), sig);
|
||||||
|
+ _exit(0);
|
||||||
|
+ }
|
||||||
|
+ jump_with_sig = 0;
|
||||||
|
+#endif /* HAVE_POSIX_SIGSETJMP */
|
||||||
|
+
|
||||||
|
xtrace_init ();
|
||||||
|
|
||||||
|
#if defined (USING_BASH_MALLOC) && defined (DEBUG) && !defined (DISABLE_MALLOC_WRAPPERS)
|
||||||
|
|
||||||
-for ac_func in bcopy bzero confstr faccessat fnmatch \
|
|
||||||
+for ac_func in atexit bcopy bzero confstr faccessat fnmatch \
|
|
||||||
getaddrinfo gethostbyname getservbyname getservent inet_aton \
|
|
||||||
memmove pathconf putenv raise regcomp regexec \
|
|
||||||
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
|
|
||||||
--- configure.in
|
|
||||||
+++ configure.in 2011-03-08 11:20:46.020641745 +0000
|
|
||||||
@@ -727,7 +727,7 @@ AC_CHECK_FUNCS(dup2 eaccess fcntl getdta
|
|
||||||
AC_REPLACE_FUNCS(rename)
|
|
||||||
|
|
||||||
dnl checks for c library functions
|
|
||||||
-AC_CHECK_FUNCS(bcopy bzero confstr faccessat fnmatch \
|
|
||||||
+AC_CHECK_FUNCS(atexit bcopy bzero confstr faccessat fnmatch \
|
|
||||||
getaddrinfo gethostbyname getservbyname getservent inet_aton \
|
|
||||||
memmove pathconf putenv raise regcomp regexec \
|
|
||||||
setenv setlinebuf setlocale setvbuf siginterrupt strchr \
|
|
||||||
--- sig.c
|
--- sig.c
|
||||||
+++ sig.c 2011-03-08 11:32:29.067927069 +0000
|
+++ sig.c 2011-03-08 17:26:31.627928783 +0000
|
||||||
@@ -292,6 +292,11 @@ initialize_terminating_signals ()
|
@@ -503,7 +503,7 @@ termsig_sighandler (sig)
|
||||||
|
/* XXX - should this also trigger when interrupt_immediately is set? */
|
||||||
#endif /* !HAVE_POSIX_SIGNALS */
|
|
||||||
|
|
||||||
+#if defined (HISTORY) && defined (HAVE_ATEXIT)
|
|
||||||
+ if (interactive_shell)
|
|
||||||
+ atexit(maybe_save_shell_history);
|
|
||||||
+#endif /* HISTORY && HAVE_ATEXIT */
|
|
||||||
+
|
|
||||||
termsigs_initialized = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -504,8 +509,11 @@ termsig_sighandler (sig)
|
|
||||||
if (terminate_immediately)
|
if (terminate_immediately)
|
||||||
{
|
{
|
||||||
#if defined (HISTORY)
|
-#if defined (HISTORY)
|
||||||
- /* XXX - will inhibit history file being written */
|
+#if defined (HISTORY) && ! defined (HAVE_POSIX_SIGSETJMP)
|
||||||
- history_lines_this_session = 0;
|
/* XXX - will inhibit history file being written */
|
||||||
+# if defined (HAVE_ATEXIT)
|
history_lines_this_session = 0;
|
||||||
+ if (sig == SIGABRT)
|
|
||||||
+# endif
|
|
||||||
+ /* XXX - will inhibit history file being written */
|
|
||||||
+ history_lines_this_session = 0;
|
|
||||||
#endif
|
#endif
|
||||||
terminate_immediately = 0;
|
@@ -514,6 +514,11 @@ termsig_sighandler (sig)
|
||||||
termsig_handler (sig);
|
SIGRETURN (0);
|
||||||
@@ -532,10 +540,10 @@ termsig_handler (sig)
|
}
|
||||||
|
|
||||||
|
+#if defined (HAVE_POSIX_SIGSETJMP)
|
||||||
|
+extern volatile procenv_t terminating_now;
|
||||||
|
+extern volatile sig_atomic_t jump_with_sig;
|
||||||
|
+#endif /* HAVE_POSIX_SIGSETJMP */
|
||||||
|
+
|
||||||
|
void
|
||||||
|
termsig_handler (sig)
|
||||||
|
int sig;
|
||||||
|
@@ -528,32 +533,39 @@ termsig_handler (sig)
|
||||||
|
handling_termsig = 1;
|
||||||
|
terminating_signal = 0; /* keep macro from re-testing true. */
|
||||||
|
|
||||||
|
+#if ! defined (HAVE_POSIX_SIGSETJMP)
|
||||||
|
/* I don't believe this condition ever tests true. */
|
||||||
if (sig == SIGINT && signal_is_trapped (SIGINT))
|
if (sig == SIGINT && signal_is_trapped (SIGINT))
|
||||||
run_interrupt_trap ();
|
run_interrupt_trap ();
|
||||||
|
|
||||||
-#if defined (HISTORY)
|
-#if defined (HISTORY)
|
||||||
+#if defined (HISTORY) && ! defined (HAVE_ATEXIT)
|
+# if defined (HISTORY)
|
||||||
if (interactive_shell && sig != SIGABRT)
|
if (interactive_shell && sig != SIGABRT)
|
||||||
maybe_save_shell_history ();
|
maybe_save_shell_history ();
|
||||||
-#endif /* HISTORY */
|
-#endif /* HISTORY */
|
||||||
+#endif /* HISTORY && ! HAVE_ATEXIT */
|
+# endif /* HISTORY */
|
||||||
|
|
||||||
#if defined (JOB_CONTROL)
|
-#if defined (JOB_CONTROL)
|
||||||
|
+# if defined (JOB_CONTROL)
|
||||||
if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
|
if (sig == SIGHUP && (interactive || (subshell_environment & (SUBSHELL_COMSUB|SUBSHELL_PROCSUB))))
|
||||||
|
hangup_all_jobs ();
|
||||||
|
end_job_control ();
|
||||||
|
-#endif /* JOB_CONTROL */
|
||||||
|
+# endif /* JOB_CONTROL */
|
||||||
|
|
||||||
|
-#if defined (PROCESS_SUBSTITUTION)
|
||||||
|
+# if defined (PROCESS_SUBSTITUTION)
|
||||||
|
unlink_fifo_list ();
|
||||||
|
-#endif /* PROCESS_SUBSTITUTION */
|
||||||
|
+# endif /* PROCESS_SUBSTITUTION */
|
||||||
|
+#endif /* ! HAVE_POSIX_SIGSETJMP */
|
||||||
|
|
||||||
|
/* Reset execution context */
|
||||||
|
loop_level = continuing = breaking = funcnest = 0;
|
||||||
|
executing_list = comsub_ignore_return = return_catch_flag = 0;
|
||||||
|
|
||||||
|
+#if defined (HAVE_POSIX_SIGSETJMP)
|
||||||
|
+ jump_with_sig = sig;
|
||||||
|
+ siglongjmp(terminating_now, 1);
|
||||||
|
+#else /* ! HAVE_POSIX_SIGSETJMP */
|
||||||
|
run_exit_trap ();
|
||||||
|
set_signal_handler (sig, SIG_DFL);
|
||||||
|
kill (getpid (), sig);
|
||||||
|
+#endif /* ! HAVE_POSIX_SIGSETJMP */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* What we really do when SIGINT occurs. */
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 8 18:47:59 CET 2011 - werner@suse.de
|
||||||
|
|
||||||
|
- Much better solution for saving history for system with sigsetjmp
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 8 12:51:29 CET 2011 - werner@suse.de
|
Tue Mar 8 12:51:29 CET 2011 - werner@suse.de
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user