bug-bash
[Top][All Lists]
Advanced

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

Re: DEBUG trap breaks pipelines


From: Anirban Sinha
Subject: Re: DEBUG trap breaks pipelines
Date: Wed, 18 Nov 2009 16:32:07 -0800 (PST)

Hi All:

This was brought up earlier this year. Unfortunatly, the patch suggested does
not even compile. Is there any updates on this issue? Was there an updated
patch that is known to have worked? We are experiencing a
very similar issue on our box.

Thanks,

Ani



lex@xxxxxx wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: x86_64
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
> -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  -D_GNU_SOURCE  -O2
-g
> -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
> --param=ssp-buffer-size=4 -m64 -mtune=generic
> uname output: Linux fiber.upc.intranet 2.6.20-1.2320.fc5 #1 SMP Tue Jun 12
> 18:50:49 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
> Machine Type: x86_64-redhat-linux-gnu
>
> Bash Version: 3.1
> Patch Level: 17
> Release Status: release
>
> Note: Configuration Information is irrelevant -- same bug in all
> versions(3.1-4.0 inclusive)/OSes(linux,tru64)/machines(alpha,i686,x86_64).
>
> Description:
>       {trap "/external/program" DEBUG} breaks pipelining in some ways. When
> trap is set:
>
>         1. A | B pipeline sometimes(*) does not run(**) second part and
hungs
> forever.
>            sometimes SIGINT(Ctrl+C) revives it, and second part starts.
>            (*) in my observation it depends on time, 'A' takes to complete
-- 
> "small" tasks does not triggers that behaviour.
>            (**) trap for the "B" part is called, but not the command "B"
> itself
>         2. A & B breaks job control
>       3. (may be not a bug) "$_" no longer contains last arg.

This was interesting.  See if the attached patch fixes 1 and 2.

Chet

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

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

*** ../bash-4.0-patched/jobs.c  2009-01-29 17:09:49.000000000 -0500
--- jobs.c      2009-04-11 15:14:27.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);
  }
*** ../bash-4.0-patched/trap.c  2009-01-16 17:07:53.000000000 -0500
--- trap.c      2009-04-11 15:11:58.000000000 -0400
***************
*** 799,802 ****
--- 799,803 ----
  {
    int trap_exit_value;
+   pid_t save_pgrp;

    /* XXX - question:  should the DEBUG trap inherit the RETURN trap? */
***************
*** 804,808 ****
--- 805,820 ----
    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 = shell_pgrp;
+       save_pipeline (1);
+       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);
+       notify_and_cleanup ();
+ #endif

  #if defined (DEBUGGER)





reply via email to

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