From: Bernhard Voelker Date: Sun, 21 Oct 2018 19:17:31 +0000 (+0200) Subject: test: remove support for the ambigous -a unary operator X-Git-Tag: v8.31~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88c32fa68ee7057744bfb6d41f6e8eb68801306f;p=thirdparty%2Fcoreutils.git test: remove support for the ambigous -a unary operator * src/test.c (unary_operator): Remove case 'a'. (test_unop): Likewise. * NEWS (Changes in behavior): Document the change. Discussed at https://bugs.gnu.org/33097 --- diff --git a/NEWS b/NEWS index ae9667e61a..a2b733d387 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,13 @@ GNU coreutils NEWS -*- outline -*- approach is still used in situations where hard links to directories are allowed (e.g., NetBSD when superuser). +** Changes in behavior + + 'test -a FILE' is not supported anymore. Long ago, there were concerns about + the high probability of humans confusing the -a primary with the -a binary + operator, so POSIX changed this to 'test -e FILE'. Scripts using it were + already broken and non-portable; the -a unary operator was never documented. + ** New features id now supports specifying multiple users. diff --git a/src/test.c b/src/test.c index aae45012a4..339a840752 100644 --- a/src/test.c +++ b/src/test.c @@ -406,8 +406,7 @@ unary_operator (void) pos right past it. This means that pos - 1 is the location of the argument. */ - case 'a': /* file exists in the file system? */ - case 'e': + case 'e': /* file exists in the file system? */ unary_advance (); return stat (argv[pos - 1], &stat_buf) == 0; @@ -586,7 +585,7 @@ test_unop (char const *op) switch (op[1]) { - case 'a': case 'b': case 'c': case 'd': case 'e': + case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'k': case 'n': case 'o': case 'p': case 'r': case 's': case 't': case 'u': case 'w': case 'x': case 'z':