bin/155786: [patch] test(1): '/bin/test -d' fails to report syntax error

jilles at FreeBSD.org jilles at FreeBSD.org
Sun Mar 2 22:07:57 UTC 2014


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


More information about the freebsd-bugs mailing list