bug-bash
[Top][All Lists]
Advanced

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

wait with trap SIGCHLD: different behaviour in 3.2 and 4.0


From: powerman
Subject: wait with trap SIGCHLD: different behaviour in 3.2 and 4.0
Date: 27 Sep 2009 20:52:37 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: i686-pc-linux-gnu-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  
-DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
 -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' 
-DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' 
-DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -march=prescott -O2 -pipe
uname output: Linux home 2.6.28-hardened-r9 #1 SMP Fri Jun 19 19:08:07 EEST 
2009 i686 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
Machine Type: i686-pc-linux-gnu

Bash Version: 4.0
Patch Level: 28
Release Status: release

Description:
        Looks like 'wait' command in bash-4 is broken: if used together
        with 'trap myhandler SIGCHLD' the 'wait' (without params) exit
        just after receiving first child exit, instead of waiting for all
        childs exit.

        This bug already reported in Gentoo Linux bugzilla at
        http://bugs.gentoo.org/show_bug.cgi?id=286360
        but received no comments in 3 days, so I decide to report it to
        bash bugtracker too.

Repeat-By:
        This command works differently on bash-3.2 and bash-4:
        $ time bash -c '
          function spawn { echo SPAWN; sleep 1 & sleep 2 & }
          set -m
          spawn
          trap spawn SIGCHLD
          wait
          '

        On app-shells/bash-3.2_p39 (and all previous bash I've used for years)
        it works as expected:

        ---cut---
        SPAWN 
        SPAWN
        [1]   Done                    sleep 1
        SPAWN
        [2]   Done                    sleep 2
        SPAWN
        [3]   Done                    sleep 1
        SPAWN
        [4]   Done                    sleep 2
        SPAWN
        SPAWN
        <Ctrl-C>

        real    0m3.288s
        user    0m0.004s
        sys     0m0.005s
        ---cut---

        but on app-shells/bash-4.0_p28 it exit in 1 second without requiring to
        press Ctrl-C:

        ---cut---
        SPAWN
        SPAWN

        real    0m1.004s
        user    0m0.001s
        sys     0m0.001s
        ---cut---





reply via email to

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