bin/137659: sh(1): /bin/sh fails to redirect stderr in backticks

Yar Tikhiy yar at FreeBSD.org
Tue Aug 11 07:30:10 UTC 2009


>Number:         137659
>Category:       bin
>Synopsis:       sh(1): /bin/sh fails to redirect stderr in backticks
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 11 07:30:09 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Yar Tikhiy
>Release:        FreeBSD 8.0-BETA2 amd64
>Organization:
BarNet
>Environment:
System: FreeBSD ref8-amd64.freebsd.org 8.0-BETA2 FreeBSD 8.0-BETA2 #11 r195838: Fri Jul 24 09:52:42 UTC 2009 simon at ref8-amd64.freebsd.org:/scratch/src/sys/amd64/compile/REF8-AMD64 amd64

>Description:
	If the command to run in backticks has no path and the shell
	fails to run it, the stderr message cannot be redirected.

	For comparison, bash redirects OK in both cases.
>How-To-Repeat:

Compare the following two cases.  In case 1, the "not found" message
is properly redirected to stdout and assigned to a variable while in
case 2 it's just emitted immediately, defying redirection.

$ out=`/var/empty/foo 2>&1`
$ echo $out
/var/empty/foo: not found
$ out=`nosuchtool 2>&1`
nosuchtool: not found
$ echo $out

$ 

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list