GNU bug report logs -
#33097
test has filetest -a but man page doesn't list it
Previous Next
Reported by: Martin Schulte <gnu <at> schrader-schulte.de>
Date: Fri, 19 Oct 2018 21:00:02 UTC
Severity: normal
Tags: confirmed, fixed
Merged with 15278
Done: Bernhard Voelker <mail <at> bernhard-voelker.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hello!
Paul Eggert wrote:
> Bernhard Voelker wrote:
> > I don't think we can remove that primary without breaking some
> > scripts, so it's probably best to document it.
>
> I have the opposite impression. Any scripts using this confusing -a
> operator are already broken, and we should phase it out. Not that
> anybody actually *uses* coreutils "test -a".
I second this - but I think it's even more important that the test from
coreutils and the bash builtin behave/are documented the same way.
"help test" lists "-a" as file test, but when negated the bash builtin
behaves different ("wronger" from my point of view) than the coreutils
version (and even different from the "-e" in both implementations) - see
attached output.
coreutils: test ! -a file -> test ! ( -a file )
bash: test ! -a file -> test ( ! ) -a ( file )
Best regards,
Martin
schulte <at> martnix4:~/langs/sh$ cat minus-a
#!/bin/bash
set -o nounset
file=/etc/passwd
echo $BASH_VERSION
/usr/bin/[ --version | head -1
for cmd in test /usr/bin/test
do
for op in -a -e
do
printf "%-30s -> " "$cmd ! $op $file" ; $cmd ! $op $file ; echo $?
done
done | cat -n
schulte <at> martnix4:~/langs/sh$ ./minus-a
4.4.12(1)-release
[ (GNU coreutils) 8.26
1 test ! -a /etc/passwd -> 0
2 test ! -e /etc/passwd -> 1
3 /usr/bin/test ! -a /etc/passwd -> 1
4 /usr/bin/test ! -e /etc/passwd -> 1
This bug report was last modified 6 years and 266 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.