bug-bash
[Top][All Lists]
Advanced

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

builtin exit status on write failure


From: Eric
Subject: builtin exit status on write failure
Date: Sun, 29 Apr 2007 21:44:24 -0600

Configuration Information [Automatically generated, do not change]:
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/home/eblake/bash-3.2.15-14/src/bash-3.2 
-I/home/eblake/bash-3.2.15-14/src/bash-3.2/include 
-I/home/eblake/bash-3.2.15-14/src/bash-3.2/lib   -O2 -pipe 
uname output: CYGWIN_NT-5.1 LOUNGE 1.5.24(0.156/4/2) 2007-01-31 10:57 i686 
Cygwin
Machine Type: i686-pc-cygwin

Bash Version: 3.2
Patch Level: 15
Release Status: release

Description:
        POSIX requires any application that writes to stdout to detect
        write failure, and exit with non-zero status as well as write
        a diagnostic to stderr.

Repeat-By:
        One example of a failure to follow this rule, using Linux's
        /dev/full to provoke a write failure:

$ cd /bin
$ cd
$ cd - >/dev/full
$ echo $?
0
$ pwd
/bin

        Oops - there was a write failure; yet no error message
        printed, the exit status remained zero, and the working
        directory changed.

Fix:
        All of the bash builtins that write to stdout need to check
        for ferror before completion, and change the exit status and
        print a message accordingly.




reply via email to

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