bug-bash
[Top][All Lists]
Advanced

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

Interactive mode, tty intr key, and $?


From: Eric Blake
Subject: Interactive mode, tty intr key, and $?
Date: Tue, 26 Jul 2005 20:14:11 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Configuration Information:
Machine: i686
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686'
- -DCONF_OSTYPE=\
'cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc'
- -DLOCALEDIR='/usr/\
share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS
- -I.  -I\
/tmp/bash-3.0 -I/tmp/bash-3.0/include -I/tmp/bash-3.0/lib   -O2
uname output: CYGWIN_NT-5.1 LOUNGE 1.5.18(0.132/4/2) 2005-07-02 20:30 i686
unkn\
own unknown Cygwin
Machine Type: i686-pc-cygwin

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
Typing the tty interrupt key (usually Ctrl-C, as set by stty) during an
interactive shell changes the current value of $?, whether in vi or emacs
editing mode.  This is contrary to POSIX, which requires that $? always
reflect the exit status of the most recent pipeline.  What's worse is that
${PIPESTATUS[(( ${#PIPESTATUS[*]} - 1 ))]} is correct, it is only $? that
is corrupted.

Repeat-By:
$ bash
$ :
$ echo $? ${PIPESTATUS[*]}
0 0
$ :
$ # Oops - we're about to change 0 to 1 [Ctrl-C]
$ echo $? ${PIPESTATUS[*]}
1 0
$ (exit 2)
$ echo $? ${PIPESTATUS[*]}
2 2
$ (exit 2)
$ # Oops - we're about to change 2 to 1 [Ctrl-C]
$ echo $? ${PIPESTATUS[*]}
1 2

$ zsh
$ :
$ echo $?
0
$ :
$ # Good - no change in $? [Ctrl-C]
$ echo $?
0
$ (exit 2)
$ echo $?
2
$ (exit 2)
$ # Good - no change in $? [Ctrl-C]
$ echo $?
2

Fix:
Unknown

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC5u3z84KuGfSFAYARAjxWAKCMj5ec4orpqio1UiHuq9wwRQJ1uQCgzRfc
0gxhq5sqjb3eRhCnKsndMio=
=LZEB
-----END PGP SIGNATURE-----




reply via email to

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