7 Bug-Reported-by: Oleksiy Melnyk <lex@upc.ua>
8 Bug-Reference-ID: <20090224142233.D2FEFC004@floyd.upc.ua>
9 Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00200.html
13 Using an external command as part of the DEBUG trap when job control is
14 enabled causes pipelines to misbehave. The problem has to do with process
15 groups assigned to the pipeline and terminal.
19 *** ../bash-4.0-patched/jobs.c 2009-01-29 17:09:49.000000000 -0500
20 --- jobs.c 2009-04-17 21:08:20.000000000 -0400
23 the_pipeline = saved_pipeline;
24 already_making_children = saved_already_making_children;
26 discard_pipeline (old_pipeline);
29 the_pipeline = saved_pipeline;
30 already_making_children = saved_already_making_children;
31 ! if (discard && old_pipeline)
32 discard_pipeline (old_pipeline);
40 + save_pgrp_pipe (p, clear)
44 + p[0] = pgrp_pipe[0];
45 + p[1] = pgrp_pipe[1];
47 + pgrp_pipe[0] = pgrp_pipe[1] = -1;
51 + restore_pgrp_pipe (p)
54 + pgrp_pipe[0] = p[0];
55 + pgrp_pipe[1] = p[1];
58 #endif /* PGRP_PIPE */
59 *** ../bash-4.0-patched/jobs.h 2009-01-04 14:32:29.000000000 -0500
60 --- jobs.h 2009-04-17 15:07:51.000000000 -0400
65 extern void close_pgrp_pipe __P((void));
66 + extern void save_pgrp_pipe __P((int *, int));
67 + extern void restore_pgrp_pipe __P((int *));
69 #if defined (JOB_CONTROL)
70 *** ../bash-4.0-patched/trap.c 2009-01-16 17:07:53.000000000 -0500
71 --- trap.c 2009-04-17 22:22:36.000000000 -0400
80 /* XXX - question: should the DEBUG trap inherit the RETURN trap? */
84 if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
86 + #if defined (JOB_CONTROL)
87 + save_pgrp = pipeline_pgrp;
90 + # if defined (PGRP_PIPE)
91 + save_pgrp_pipe (save_pipe, 1);
93 + stop_making_children ();
96 trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
98 + #if defined (JOB_CONTROL)
99 + pipeline_pgrp = save_pgrp;
100 + restore_pipeline (1);
101 + # if defined (PGRP_PIPE)
102 + close_pgrp_pipe ();
103 + restore_pgrp_pipe (save_pipe);
105 + if (pipeline_pgrp > 0)
106 + give_terminal_to (pipeline_pgrp, 1);
107 + notify_and_cleanup ();
110 #if defined (DEBUGGER)
111 *** ../bash-4.0/patchlevel.h 2009-01-04 14:32:40.000000000 -0500
112 --- patchlevel.h 2009-02-22 16:11:31.000000000 -0500
115 looks for to find the patch level (for the sccs version string). */
117 ! #define PATCHLEVEL 18
119 #endif /* _PATCHLEVEL_H_ */
121 looks for to find the patch level (for the sccs version string). */
123 ! #define PATCHLEVEL 19
125 #endif /* _PATCHLEVEL_H_ */