Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Mar 2014 22:07:56 GMT
From:      jilles@FreeBSD.org
To:        pirzyk@freebsd.org, jilles@FreeBSD.org, freebsd-bugs@FreeBSD.org, jilles@FreeBSD.org
Subject:   Re: bin/155786: [patch] test(1): '/bin/test -d' fails to report syntax error
Message-ID:  <201403022207.s22M7uMZ043941@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
Synopsis: [patch] test(1): '/bin/test -d' fails to report syntax error

State-Changed-From-To: open->closed
State-Changed-By: jilles
State-Changed-When: Sun Mar 2 22:06:16 UTC 2014
State-Changed-Why: 
This is not a bug.
'/bin/test -d' is not an error and is supposed to return true (0).

This is because '-d' in 'test -d' is a string operand that is tested
for non-emptiness. In the man page test(1):

     string        True if string is not the null string.

In the POSIX specification (SUSv4+TC1), also look for the algorithm for
resolving the ambiguities in test:

> 1 argument: Exit true (0) if $1 is not null; otherwise, exit false.


Responsible-Changed-From-To: freebsd-bugs->jilles
Responsible-Changed-By: jilles
Responsible-Changed-When: Sun Mar 2 22:06:16 UTC 2014
Responsible-Changed-Why: 
Track replies.

http://www.freebsd.org/cgi/query-pr.cgi?pr=155786



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