Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2009 07:22:49 GMT
From:      Yar Tikhiy <yar@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/137659: sh(1): /bin/sh fails to redirect stderr in backticks
Message-ID:  <200908110722.n7B7Mn2Q042065@ref8-amd64.freebsd.org>
Resent-Message-ID: <200908110730.n7B7U9l4002939@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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@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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908110722.n7B7Mn2Q042065>