NetBSD-Bugs archive

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

bin/47065: /bin/sh returns success for Bad file descriptor



>Number:         47065
>Category:       bin
>Synopsis:       /bin/sh returns success for Bad file descriptor
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 13 09:25:00 +0000 2012
>Originator:     Iku Iwasa
>Release:        6.99.11
>Organization:
>Environment:
NetBSD localhost 6.99.11 NetBSD 6.99.11 (GENERIC) #0: Sat Sep 29 15:21:39 JST 
2012  root@localhost:/usr/obj/sys/arch/i386/compile/GENERIC i386
>Description:
/bin/sh returns 0 for the following Bad file descriptor case while other shells 
not.
-----------------------------------------
$ /bin/sh -c 'cat <&3'; echo $?
sh: 3: Bad file descriptor
0
$ /bin/ksh -c 'cat <&3'; echo $?                                                
           

/bin/ksh: <&3 : bad file descriptor
1
$ /usr/pkg/bin/bash -c 'cat <&3'; echo $?                                       
           

/usr/pkg/bin/bash: 3: Bad file descriptor
1
$ /usr/pkg/bin/zsh -c 'cat <&3'; echo $?                                        
           

zsh:1: 3: bad file descriptor
1
-----------------------------------------
>How-To-Repeat:
$ /bin/sh -c 'cat <&3'; echo $?
sh: 3: Bad file descriptor
0
>Fix:
I am not sure, but exerrno should be set before error() in copyfd()?



Home | Main Index | Thread Index | Old Index