[Top][All Lists]

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

can't avoid double message in trap 'echo; exit' with backquoted code

From: ahuxley
Subject: can't avoid double message in trap 'echo; exit' with backquoted code
Date: Fri, 30 Nov 2001 10:53:19 +0100 (MET)

Configuration Information [Automatically generated, do not change]:
Machine: hppa2.0
OS: hpux11.00
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='hppa2.0' 
-DCONF_OSTYPE='hpux11.00' -DCONF_MACHTYPE='hppa2.0-hp-hpux11.00' 
-I/opt/bash/include -g -O2
uname output: HP-UX te35 B.11.00 A 9000/785 2008900992 two-user license
Machine Type: hppa2.0-hp-hpux11.00

Bash Version: 2.03
Patch Level: 0
Release Status: release

        Setting up a trap to display a message and exit, and then 
        invoking the signal handler while in a backquoted section of
        code results in the trap's message appearing twice. 

        All other OS's and Bourne-like shells produce the message only 
        once. But despite the subshell, the trap message comes from the 
        same pid each time.
        No amount of '|| exit' added to each read/function call prevent
        the second message appearing.

        (I tried to verify whether this bug was present in latest bash
        (2.05a) but I couldn't compile it for HP-UX 10.20 or 11.00. 
        A separate bug report has been files for that.)

        Run the following script:

            typeset LOCAL_X
            echo "Press CTRL-C now: " > /dev/tty
            read LOCAL_X < /dev/tty
            echo "$LOCAL_X"
            trap 'echo "got CTRL-C, this message should appear only once, pid 
$$ exiting ..." > /dev/tty; exit 1' 2
        main "$@"

Alexis Huxley

reply via email to

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