bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bash-4.0 Official Patch 19


From: Chet Ramey
Subject: Bash-4.0 Official Patch 19
Date: Thu, 18 Jun 2009 20:53:35 -0400

                             BASH PATCH REPORT
                             =================

Bash-Release: 4.0
Patch-ID: bash40-019

Bug-Reported-by: Oleksiy Melnyk <lex@upc.ua>
Bug-Reference-ID: <20090224142233.D2FEFC004@floyd.upc.ua>
Bug-Reference-URL: 
http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00200.html

Bug-Description:

Using an external command as part of the DEBUG trap when job control is
enabled causes pipelines to misbehave.  The problem has to do with process
groups assigned to the pipeline and terminal.

Patch:

*** ../bash-4.0-patched/jobs.c  2009-01-29 17:09:49.000000000 -0500
--- jobs.c      2009-04-17 21:08:20.000000000 -0400
***************
*** 443,447 ****
    the_pipeline = saved_pipeline;
    already_making_children = saved_already_making_children;
!   if (discard)
      discard_pipeline (old_pipeline);
  }
--- 443,447 ----
    the_pipeline = saved_pipeline;
    already_making_children = saved_already_making_children;
!   if (discard && old_pipeline)
      discard_pipeline (old_pipeline);
  }
***************
*** 4203,4205 ****
--- 4204,4225 ----
  }
  
+ void
+ save_pgrp_pipe (p, clear)
+      int *p;
+      int clear;
+ {
+   p[0] = pgrp_pipe[0];
+   p[1] = pgrp_pipe[1];
+   if (clear)
+     pgrp_pipe[0] = pgrp_pipe[1] = -1;
+ }
+ 
+ void
+ restore_pgrp_pipe (p)
+      int *p;
+ {
+   pgrp_pipe[0] = p[0];
+   pgrp_pipe[1] = p[1];
+ }
+ 
  #endif /* PGRP_PIPE */
*** ../bash-4.0-patched/jobs.h  2009-01-04 14:32:29.000000000 -0500
--- jobs.h      2009-04-17 15:07:51.000000000 -0400
***************
*** 236,239 ****
--- 236,241 ----
  
  extern void close_pgrp_pipe __P((void));
+ extern void save_pgrp_pipe __P((int *, int));
+ extern void restore_pgrp_pipe __P((int *));
  
  #if defined (JOB_CONTROL)
*** ../bash-4.0-patched/trap.c  2009-01-16 17:07:53.000000000 -0500
--- trap.c      2009-04-17 22:22:36.000000000 -0400
***************
*** 799,802 ****
--- 799,804 ----
  {
    int trap_exit_value;
+   pid_t save_pgrp;
+   int save_pipe[2];
  
    /* XXX - question:  should the DEBUG trap inherit the RETURN trap? */
***************
*** 804,808 ****
--- 806,832 ----
    if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && ((sigmodes[DEBUG_TRAP] & 
SIG_IGNORED) == 0) && ((sigmodes[DEBUG_TRAP] & SIG_INPROGRESS) == 0))
      {
+ #if defined (JOB_CONTROL)
+       save_pgrp = pipeline_pgrp;
+       pipeline_pgrp = 0;
+       save_pipeline (1);
+ #  if defined (PGRP_PIPE)
+       save_pgrp_pipe (save_pipe, 1);
+ #  endif
+       stop_making_children ();
+ #endif
+ 
        trap_exit_value = _run_trap_internal (DEBUG_TRAP, "debug trap");
+ 
+ #if defined (JOB_CONTROL)
+       pipeline_pgrp = save_pgrp;
+       restore_pipeline (1);
+ #  if defined (PGRP_PIPE)
+       close_pgrp_pipe ();
+       restore_pgrp_pipe (save_pipe);
+ #  endif
+       if (pipeline_pgrp > 0)
+       give_terminal_to (pipeline_pgrp, 1);
+       notify_and_cleanup ();
+ #endif
        
  #if defined (DEBUGGER)
*** ../bash-4.0/patchlevel.h    2009-01-04 14:32:40.000000000 -0500
--- patchlevel.h        2009-02-22 16:11:31.000000000 -0500
***************
*** 26,30 ****
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 18
  
  #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
     looks for to find the patch level (for the sccs version string). */
  
! #define PATCHLEVEL 19
  
  #endif /* _PATCHLEVEL_H_ */

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]