NetBSD-Bugs archive

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

bin/42184: /bin/sh: stderr vs. command not found



>Number:         42184
>Category:       bin
>Synopsis:       /bin/sh: stderr vs. command not found
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 14 18:20:00 +0000 2009
>Originator:     Aleksey Cheusov
>Release:        NetBSD 5.0_STABLE
>Organization:
>Environment:
System: NetBSD chen.chizhovka.net 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #0: 
Sat Sep 12 14:12:09 EEST 2009 
cheusov%chen.chizhovka.net@localhost:/srv/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

/bin/sh doesn't print "xxx: not found" to stderr
in case xxx cannot be found.

   1 ~>cat /home/cheusov/tmp/1.sh                      
   #!/bin/sh

   bad_command_name 2>/dev/null

   0 ~>/bin/sh /home/cheusov/tmp/1.sh
   bad_command_name: not found
   127 ~>bash /home/cheusov/tmp/1.sh    
   127 ~>zsh /home/cheusov/tmp/1.sh  
   127 ~>ksh /home/cheusov/tmp/1.sh 
   127 ~>dash /home/cheusov/tmp/1.sh
   127 ~>pdksh /home/cheusov/tmp/1.sh
   127 ~>/usr/pkg/heirloom/bin/sh /home/cheusov/tmp/1.sh                        
   /home/cheusov/tmp/1.sh: bad_command_name: not found
   1 ~>

I assume this is a bug because
a) wrapping of bad command envocation into
   a shell function solves the problrem.

   0 ~>cat /home/cheusov/tmp/1.sh 
   #!/bin/sh

   wrapper (){
       bad_command_name
   }

   wrapper 2>/dev/null

   0 ~>/bin/sh /home/cheusov/tmp/1.sh
   127 ~>bash /home/cheusov/tmp/1.sh    
   127 ~>zsh /home/cheusov/tmp/1.sh  
   127 ~>dash /home/cheusov/tmp/1.sh
   127 ~>pdksh /home/cheusov/tmp/1.sh
   127 ~>/usr/pkg/heirloom/bin/sh /home/cheusov/tmp/1.sh
   1 ~>

b) most other shells works as expected.

FreeBSD /bin/sh (ash derivate too) is also broken here.

>Fix:

Unknown


Home | Main Index | Thread Index | Old Index