|
|
c4b182 |
From f5a43df0bd6481b407a6ec00a24679f521584e20 Mon Sep 17 00:00:00 2001
|
|
|
c4b182 |
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
|
c4b182 |
Date: Mon, 22 Apr 2013 21:49:40 +0100
|
|
|
c4b182 |
Subject: [PATCH] Resolves: #1116237 - find -perm +numeric does not work as
|
|
|
c4b182 |
expected
|
|
|
c4b182 |
|
|
|
c4b182 |
Also, do not reject -perm /MODE merely because of POSIXLY_CORRECT.
|
|
|
c4b182 |
Problem reported in <https://savannah.gnu.org/bugs/?38474>.
|
|
|
c4b182 |
* doc/find.texi (Mode Bits): Document this.
|
|
|
c4b182 |
* find/parser.c (parse_help): Mention /MODE, not +MODE.
|
|
|
c4b182 |
Do not reject -perm /MODE merely because POSIXLY_CORRECT is set;
|
|
|
c4b182 |
POSIXLY_CORRECT is not supposed to be for pedantic checking.
|
|
|
c4b182 |
|
|
|
c4b182 |
[upstream commit 90f0c5d24153ad3327edd6f2249fc95a5cfb72e0]
|
|
|
c4b182 |
|
|
|
c4b182 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
c4b182 |
---
|
|
|
c4b182 |
doc/find.texi | 11 ++---------
|
|
|
c4b182 |
find/find.1 | 17 ++++++++++++-----
|
|
|
c4b182 |
find/parser.c | 10 ++++++++--
|
|
|
c4b182 |
3 files changed, 22 insertions(+), 16 deletions(-)
|
|
|
c4b182 |
|
|
|
c4b182 |
diff --git a/doc/find.texi b/doc/find.texi
|
|
|
c4b182 |
index a44e5d5..1ad3af5 100644
|
|
|
c4b182 |
--- a/doc/find.texi
|
|
|
c4b182 |
+++ b/doc/find.texi
|
|
|
c4b182 |
@@ -1180,11 +1180,8 @@ optionally prefixed by @samp{-} or @samp{/}.
|
|
|
c4b182 |
|
|
|
c4b182 |
A @var{pmode} that starts with neither @samp{-} nor @samp{/} matches
|
|
|
c4b182 |
if @var{mode} exactly matches the file mode bits.
|
|
|
c4b182 |
-
|
|
|
c4b182 |
-A @var{pmode} that starts with @samp{+} but which is not valid (for
|
|
|
c4b182 |
-example @samp{+a+x}) is an error if the POSIXLY_CORRECT environment
|
|
|
c4b182 |
-variable it set. Otherwise this is treated as if the initial
|
|
|
c4b182 |
-@samp{+} were a @samp{/}, for backward compatibility.
|
|
|
c4b182 |
+(To avoid confusion with an obsolete GNU extension, @var{mode}
|
|
|
c4b182 |
+must not start with a @samp{+} immediately followed by an octal digit.)
|
|
|
c4b182 |
|
|
|
c4b182 |
A @var{pmode} that starts with @samp{-} matches if
|
|
|
c4b182 |
@emph{all} the file mode bits set in @var{mode} are set for the file;
|
|
|
c4b182 |
@@ -3944,10 +3941,6 @@ Setting this variable also turns off warning messages (that is, implies
|
|
|
c4b182 |
the output for @samp{-ok}, all messages printed on stderr are
|
|
|
c4b182 |
diagnostics and must result in a non-zero exit status.
|
|
|
c4b182 |
|
|
|
c4b182 |
-Arguments to @samp{-perm} beginning with @samp{+} are treated
|
|
|
c4b182 |
-differently when POSIXLY_CORRECT is set. See
|
|
|
c4b182 |
-@ref{Mode Bits,-perm,File Mode Bits}.
|
|
|
c4b182 |
-
|
|
|
c4b182 |
When POSIXLY_CORRECT is set, the response to the prompt made by the
|
|
|
c4b182 |
@code{-ok} action is interpreted according to the system's message
|
|
|
c4b182 |
catalogue, as opposed to according to @code{find}'s own message
|
|
|
c4b182 |
diff --git a/find/find.1 b/find/find.1
|
|
|
c4b182 |
index 34a4cba..00e45e6 100644
|
|
|
c4b182 |
--- a/find/find.1
|
|
|
c4b182 |
+++ b/find/find.1
|
|
|
c4b182 |
@@ -2046,11 +2046,6 @@ As of findutils-4.2.2, shell metacharacters (`*', `?' or `[]' for
|
|
|
c4b182 |
example) used in filename patterns will match a leading `.', because
|
|
|
c4b182 |
IEEE POSIX interpretation 126 requires this.
|
|
|
c4b182 |
.P
|
|
|
c4b182 |
-The syntax
|
|
|
c4b182 |
-\.B \-perm +MODE
|
|
|
c4b182 |
-was deprecated in findutils-4.2.21, in favour of
|
|
|
c4b182 |
-\.B \-perm
|
|
|
c4b182 |
-.BR /MODE .
|
|
|
c4b182 |
As of findutils-4.3.3,
|
|
|
c4b182 |
.B \-perm /000
|
|
|
c4b182 |
now matches all files instead of none.
|
|
|
c4b182 |
@@ -2098,6 +2093,18 @@ Feature Added in Also occurs in
|
|
|
c4b182 |
\-ipath 3.8
|
|
|
c4b182 |
\-iregex 3.8
|
|
|
c4b182 |
.TE
|
|
|
c4b182 |
+.P
|
|
|
c4b182 |
+The syntax
|
|
|
c4b182 |
+\.B \-perm +MODE
|
|
|
c4b182 |
+does not work as expected in findutils-4.5.11 and it
|
|
|
c4b182 |
+was removed in findutils-4.5.12, in favour of
|
|
|
c4b182 |
+\.B \-perm
|
|
|
c4b182 |
+.BR /MODE .
|
|
|
c4b182 |
+The
|
|
|
c4b182 |
+.B +MODE
|
|
|
c4b182 |
+syntax had been deprecated since findutils-4.2.21
|
|
|
c4b182 |
+which was released in 2005.
|
|
|
c4b182 |
+.P
|
|
|
c4b182 |
.SH "NON-BUGS"
|
|
|
c4b182 |
.nf
|
|
|
c4b182 |
.B $ find . \-name *.c \-print
|
|
|
c4b182 |
diff --git a/find/parser.c b/find/parser.c
|
|
|
c4b182 |
index d15c0e0..e5f02b3 100644
|
|
|
c4b182 |
--- a/find/parser.c
|
|
|
c4b182 |
+++ b/find/parser.c
|
|
|
c4b182 |
@@ -1239,7 +1239,7 @@ tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N\n\
|
|
|
c4b182 |
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN\n\
|
|
|
c4b182 |
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE"));
|
|
|
c4b182 |
puts (_("\
|
|
|
c4b182 |
- -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN\n\
|
|
|
c4b182 |
+ -nouser -nogroup -path PATTERN -perm [-/]MODE -regex PATTERN\n\
|
|
|
c4b182 |
-readable -writable -executable\n\
|
|
|
c4b182 |
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N\n\
|
|
|
c4b182 |
-used N -user NAME -xtype [bcdpfls]"));
|
|
|
c4b182 |
@@ -1981,6 +1981,13 @@ parse_perm (const struct parser_table* entry, char **argv, int *arg_ptr)
|
|
|
c4b182 |
break;
|
|
|
c4b182 |
|
|
|
c4b182 |
case '+':
|
|
|
c4b182 |
+ if ('0' <= perm_expr[1] && perm_expr[1] < '8')
|
|
|
c4b182 |
+ /* warn about using obsolete syntax (with unexpected behavior) */
|
|
|
c4b182 |
+ error(0, 0, "warning: you are using `-perm +MODE'. The "
|
|
|
c4b182 |
+ "interpretation of `-perm +omode' changed in findutils-4.5.11. "
|
|
|
c4b182 |
+ "The syntax `-perm +omode' was removed in findutils-4.5.12, in "
|
|
|
c4b182 |
+ "favour of `-perm /omode'.");
|
|
|
c4b182 |
+
|
|
|
c4b182 |
change = mode_compile (perm_expr);
|
|
|
c4b182 |
if (NULL == change)
|
|
|
c4b182 |
{
|
|
|
c4b182 |
@@ -2011,7 +2018,6 @@ parse_perm (const struct parser_table* entry, char **argv, int *arg_ptr)
|
|
|
c4b182 |
break;
|
|
|
c4b182 |
|
|
|
c4b182 |
case '/': /* GNU extension */
|
|
|
c4b182 |
- non_posix_mode (perm_expr);
|
|
|
c4b182 |
mode_start = 1;
|
|
|
c4b182 |
kind = PERM_ANY;
|
|
|
c4b182 |
havekind = true;
|
|
|
c4b182 |
--
|
|
|
c4b182 |
1.9.3
|
|
|
c4b182 |
|