bin/130298: /bin/sh does not handle negation correctly in complex commands

Martin Beran mb at tns.cz
Thu Jan 8 04:30:02 PST 2009


>Number:         130298
>Category:       bin
>Synopsis:       /bin/sh does not handle negation correctly in complex commands
>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:   Thu Jan 08 12:30:01 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Martin Beran
>Release:        7.0-RELEASE-p6
>Organization:
Trusted Network Solutions, a. s.
>Environment:
FreeBSD mb.tns.cz 7.0-RELEASE-p6 FreeBSD 7.0-RELEASE-p6 #2: Wed Nov 26 09:21:51 CET 2008     root at mb.tns.cz:/usr/obj/usr/src/sys/MB  i386
>Description:
Negation of a pipeline exit status (the shell construct ! cmd1 | cmd2) does not work when joined with another command by &&: cmd3 && ! cmd1 | cmd2. The exit status is the same as in: cmd3 && cmd1 | cmd2. Using braces triggers the correct behavior: cmd3 && { ! cmd1 | cmd2; }.
>How-To-Repeat:
true && ! true | true; echo $?
This should display 1 (as it does, for example, in bash), but displays 0.
>Fix:
true && ! true | true; echo $?

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


More information about the freebsd-bugs mailing list