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
This commit is contained in:
Bernhard Voelker committed 2018-10-26 10:53:57 +02:00
1 parent 6bc89f5f85
commit 88c32fa68e
2 files changed
+9 -3

No files matched your search

+7
View File
@@ -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.
+2 -3
View 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':