Date: Thu, 8 Jan 2009 12:21:05 GMT From: Martin Beran <mb@tns.cz> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/130298: /bin/sh does not handle negation correctly in complex commands Message-ID: <200901081221.n08CL5J9094796@www.freebsd.org> Resent-Message-ID: <200901081230.n08CU2qv058320@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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@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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901081221.n08CL5J9094796>
