GNU bug report logs - #33097
test has filetest -a but man page doesn't list it

Previous Next

Package: coreutils;

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


Message #17 received at 33097 <at> debbugs.gnu.org (full text, mbox):

From: Martin Schulte <gnu <at> schrader-schulte.de>
To: 33097 <at> debbugs.gnu.org
Cc: Bernhard Voelker <mail <at> bernhard-voelker.de>,
 Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#33097: test has filetest -a but man page doesn't list it
Date: Sun, 21 Oct 2018 10:29:09 +0200
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 267 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.