]> git.pld-linux.org Git - packages/bash.git/blob - bash40-019
- up to 4.0.33
[packages/bash.git] / bash40-019
1                              BASH PATCH REPORT
2                              =================
3
4 Bash-Release: 4.0
5 Patch-ID: bash40-019
6
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
10
11 Bug-Description:
12
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.
16
17 Patch:
18
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
21 ***************
22 *** 443,447 ****
23     the_pipeline = saved_pipeline;
24     already_making_children = saved_already_making_children;
25 !   if (discard)
26       discard_pipeline (old_pipeline);
27   }
28 --- 443,447 ----
29     the_pipeline = saved_pipeline;
30     already_making_children = saved_already_making_children;
31 !   if (discard && old_pipeline)
32       discard_pipeline (old_pipeline);
33   }
34 ***************
35 *** 4203,4205 ****
36 --- 4204,4225 ----
37   }
38   
39 + void
40 + save_pgrp_pipe (p, clear)
41 +      int *p;
42 +      int clear;
43 + {
44 +   p[0] = pgrp_pipe[0];
45 +   p[1] = pgrp_pipe[1];
46 +   if (clear)
47 +     pgrp_pipe[0] = pgrp_pipe[1] = -1;
48 + }
49
50 + void
51 + restore_pgrp_pipe (p)
52 +      int *p;
53 + {
54 +   pgrp_pipe[0] = p[0];
55 +   pgrp_pipe[1] = p[1];
56 + }
57
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
61 ***************
62 *** 236,239 ****
63 --- 236,241 ----
64   
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 *));
68   
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
72 ***************
73 *** 799,802 ****
74 --- 799,804 ----
75   {
76     int trap_exit_value;
77 +   pid_t save_pgrp;
78 +   int save_pipe[2];
79   
80     /* XXX - question:  should the DEBUG trap inherit the RETURN trap? */
81 ***************
82 *** 804,808 ****
83 --- 806,832 ----
84     if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
85       {
86 + #if defined (JOB_CONTROL)
87 +       save_pgrp = pipeline_pgrp;
88 +       pipeline_pgrp = 0;
89 +       save_pipeline (1);
90 + #  if defined (PGRP_PIPE)
91 +       save_pgrp_pipe (save_pipe, 1);
92 + #  endif
93 +       stop_making_children ();
94 + #endif
95
96         trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
97
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);
104 + #  endif
105 +       if (pipeline_pgrp > 0)
106 +       give_terminal_to (pipeline_pgrp, 1);
107 +       notify_and_cleanup ();
108 + #endif
109         
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
113 ***************
114 *** 26,30 ****
115      looks for to find the patch level (for the sccs version string). */
116   
117 ! #define PATCHLEVEL 18
118   
119   #endif /* _PATCHLEVEL_H_ */
120 --- 26,30 ----
121      looks for to find the patch level (for the sccs version string). */
122   
123 ! #define PATCHLEVEL 19
124   
125   #endif /* _PATCHLEVEL_H_ */
This page took 0.039768 seconds and 3 git commands to generate.