Blame SOURCES/bash-4.1-trap.patch

77bcbf
Only in bash-4.1: _patchlevel
77bcbf
diff -rup bash-4.1.orig/trap.c bash-4.1/trap.c
77bcbf
--- bash-4.1.orig/trap.c	2013-05-14 13:58:06.224000564 +0900
77bcbf
+++ bash-4.1/trap.c	2013-06-26 16:59:42.968001502 +0900
77bcbf
@@ -269,6 +269,9 @@ run_pending_traps ()
77bcbf
   if (catch_flag == 0)		/* simple optimization */
77bcbf
     return;
77bcbf
 
77bcbf
+  if (running_trap > 0)
77bcbf
+    return;			/* no recursive trap invocations */
77bcbf
+
77bcbf
   catch_flag = 0;
77bcbf
 
77bcbf
   /* Preserve $? when running trap. */
77bcbf
@@ -294,6 +297,8 @@ run_pending_traps ()
77bcbf
 #  endif
77bcbf
 #endif /* HAVE_POSIX_SIGNALS */
77bcbf
 
77bcbf
+	  running_trap = sig + 1;
77bcbf
+
77bcbf
 	  if (sig == SIGINT)
77bcbf
 	    {
77bcbf
 	      run_interrupt_trap ();
77bcbf
@@ -338,7 +343,14 @@ run_pending_traps ()
77bcbf
 	      save_subst_varlist = subst_assign_varlist;
77bcbf
 	      subst_assign_varlist = 0;
77bcbf
 
77bcbf
+#if defined (JOB_CONTROL)
77bcbf
+	      save_pipeline (1);        /* XXX only provides one save level */
77bcbf
+#endif
77bcbf
 	      parse_and_execute (savestring (trap_list[sig]), "trap", SEVAL_NONINT|SEVAL_NOHIST|SEVAL_RESETLINE);
77bcbf
+#if defined (JOB_CONTROL)
77bcbf
+	      restore_pipeline (1);
77bcbf
+#endif
77bcbf
+
77bcbf
 	      restore_token_state (token_state);
77bcbf
 	      free (token_state);
77bcbf
 
77bcbf
@@ -346,6 +358,7 @@ run_pending_traps ()
77bcbf
 	    }
77bcbf
 
77bcbf
 	  pending_traps[sig] = 0;
77bcbf
+	  running_trap = 0;
77bcbf
 
77bcbf
 #if defined (HAVE_POSIX_SIGNALS)
77bcbf
 	  sigprocmask (SIG_SETMASK, &oset, (sigset_t *)NULL);