]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
test: remove support for the ambigous -a unary operator
authorBernhard Voelker <mail@bernhard-voelker.de>
Sun, 21 Oct 2018 19:17:31 +0000 (21:17 +0200)
committerBernhard Voelker <mail@bernhard-voelker.de>
Fri, 26 Oct 2018 08:53:57 +0000 (10:53 +0200)
* 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

NEWS
src/test.c

diff --git a/NEWS b/NEWS
index ae9667e61ac20f51a907bc0b58b1d319506c7494..a2b733d387b141daa2aa04e37e4f199491e42754 100644 (file)
--- 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.
index aae45012a46b77b2e2c9b4f8428acd457294c1be..339a840752b584418ed22be13e1ef1d7b8e920f1 100644 (file)
@@ -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':