summaryrefslogtreecommitdiff
path: root/debian/patches/bash32-035.dpatch
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-09 16:13:32 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-09 16:15:01 -0700
commit2d698b6e42d8dca191ac795ef5dba3bf62496eec (patch)
treeac5e0b67043c50f49160e9fe407435706cf30444 /debian/patches/bash32-035.dpatch
parentf1250933e4a2ac09a3d0b25b3877068e12f44da5 (diff)
downloadvyatta-bash-2d698b6e42d8dca191ac795ef5dba3bf62496eec.tar.gz
vyatta-bash-2d698b6e42d8dca191ac795ef5dba3bf62496eec.zip
Integrate bash 3.2 version
This is merge of current Debian stable (Lenny) version of Bash with Vyatta changes.
Diffstat (limited to 'debian/patches/bash32-035.dpatch')
-rw-r--r--debian/patches/bash32-035.dpatch178
1 files changed, 178 insertions, 0 deletions
diff --git a/debian/patches/bash32-035.dpatch b/debian/patches/bash32-035.dpatch
new file mode 100644
index 0000000..6bd78d5
--- /dev/null
+++ b/debian/patches/bash32-035.dpatch
@@ -0,0 +1,178 @@
+#! /bin/sh -e
+
+if [ $# -eq 3 -a "$2" = '-d' ]; then
+ pdir="-d $3"
+elif [ $# -ne 1 ]; then
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+fi
+case "$1" in
+ -patch) patch $pdir -f --no-backup-if-mismatch -p0 < $0;;
+ -unpatch) patch $pdir -f --no-backup-if-mismatch -R -p0 < $0;;
+ *)
+ echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
+ exit 1
+esac
+exit 0
+
+# DP: bash-3.2 upstream patch bash32-035
+
+ BASH PATCH REPORT
+ =================
+
+Bash-Release: 3.2
+Patch-ID: bash32-035
+
+Bug-Reported-by: Ingo Molnar <mingo@elte.hu>
+Bug-Reference-ID: <20071205202901.GA25202@elte.hu>
+Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2007-12/msg00014.html
+
+Bug-Description:
+
+Bash incorrectly puts the second and subsequent children spawned by a
+shell forked to run a command substitution in the wrong process group.
+
+Patch:
+
+*** ../bash-3.2-patched/subst.c 2007-12-13 22:31:21.000000000 -0500
+--- subst.c 2008-01-17 22:48:15.000000000 -0500
+***************
+*** 4621,4627 ****
+
+ #if defined (JOB_CONTROL)
+ set_sigchld_handler ();
+ stop_making_children ();
+! pipeline_pgrp = old_pipeline_pgrp;
+ #else
+ stop_making_children ();
+--- 4721,4728 ----
+
+ #if defined (JOB_CONTROL)
+ set_sigchld_handler ();
+ stop_making_children ();
+! if (pid != 0)
+! pipeline_pgrp = old_pipeline_pgrp;
+ #else
+ stop_making_children ();
+*** ../bash-3.2-patched/jobs.c 2007-08-25 13:46:59.000000000 -0400
+--- jobs.c 2007-12-08 16:47:43.000000000 -0500
+***************
+*** 251,254 ****
+--- 251,255 ----
+ static int set_job_status_and_cleanup __P((int));
+
++ static WAIT job_signal_status __P((int));
+ static WAIT raw_job_exit_status __P((int));
+
+***************
+*** 2220,2223 ****
+--- 2238,2261 ----
+ }
+
++ static WAIT
++ job_signal_status (job)
++ int job;
++ {
++ register PROCESS *p;
++ WAIT s;
++
++ p = jobs[job]->pipe;
++ do
++ {
++ s = p->status;
++ if (WIFSIGNALED(s) || WIFSTOPPED(s))
++ break;
++ p = p->next;
++ }
++ while (p != jobs[job]->pipe);
++
++ return s;
++ }
++
+ /* Return the exit status of the last process in the pipeline for job JOB.
+ This is the exit status of the entire job. */
+***************
+*** 2302,2310 ****
+ received, only if one of the jobs run is killed via SIGINT. If
+ job control is not set, the job will be run in the same pgrp as
+! the shell, and the shell will see any signals the job gets. */
+
+ /* This is possibly a race condition -- should it go in stop_pipeline? */
+ wait_sigint_received = 0;
+! if (job_control == 0)
+ {
+ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
+--- 2343,2354 ----
+ received, only if one of the jobs run is killed via SIGINT. If
+ job control is not set, the job will be run in the same pgrp as
+! the shell, and the shell will see any signals the job gets. In
+! fact, we want this set every time the waiting shell and the waited-
+! for process are in the same process group, including command
+! substitution. */
+
+ /* This is possibly a race condition -- should it go in stop_pipeline? */
+ wait_sigint_received = 0;
+! if (job_control == 0 || (subshell_environment&SUBSHELL_COMSUB))
+ {
+ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
+***************
+*** 2452,2464 ****
+ the last process in the pipeline. If no process exits due to a
+ signal, S is left as the status of the last job in the pipeline. */
+! p = jobs[job]->pipe;
+! do
+! {
+! s = p->status;
+! if (WIFSIGNALED(s) || WIFSTOPPED(s))
+! break;
+! p = p->next;
+! }
+! while (p != jobs[job]->pipe);
+
+ if (WIFSIGNALED (s) || WIFSTOPPED (s))
+--- 2496,2500 ----
+ the last process in the pipeline. If no process exits due to a
+ signal, S is left as the status of the last job in the pipeline. */
+! s = job_signal_status (job);
+
+ if (WIFSIGNALED (s) || WIFSTOPPED (s))
+***************
+*** 2494,2497 ****
+--- 2530,2551 ----
+ }
+ }
++ else if ((subshell_environment & SUBSHELL_COMSUB) && wait_sigint_received)
++ {
++ /* If waiting for a job in a subshell started to do command
++ substitution, simulate getting and being killed by the SIGINT to
++ pass the status back to our parent. */
++ s = job_signal_status (job);
++
++ if (WIFSIGNALED (s) && WTERMSIG (s) == SIGINT && signal_is_trapped (SIGINT) == 0)
++ {
++ UNBLOCK_CHILD (oset);
++ restore_sigint_handler ();
++ old_sigint_handler = set_signal_handler (SIGINT, SIG_DFL);
++ if (old_sigint_handler == SIG_IGN)
++ restore_sigint_handler ();
++ else
++ kill (getpid (), SIGINT);
++ }
++ }
+
+ /* Moved here from set_job_status_and_cleanup, which is in the SIGCHLD
+*** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006
+--- patchlevel.h Mon Oct 16 14:22:54 2006
+***************
+*** 26,30 ****
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 34
+
+ #endif /* _PATCHLEVEL_H_ */
+--- 26,30 ----
+ looks for to find the patch level (for the sccs version string). */
+
+! #define PATCHLEVEL 35
+
+ #endif /* _PATCHLEVEL_H_ */