Bug 1116237
Summary: | find -perm +numeric does not work as expected | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Tetsuo Handa <penguin-kernel> |
Component: | findutils | Assignee: | Kamil Dudka <kdudka> |
Status: | CLOSED ERRATA | QA Contact: | Filip Holec <fholec> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | 7.0 | CC: | isenfeld, ovasik, penguin-kernel, psplicha |
Target Milestone: | rc | Keywords: | Patch |
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | findutils-4.5.11-5.el7 | Doc Type: | Bug Fix |
Doc Text: |
Cause:
The deprecated '-perm +numeric' predicate of `find` worked differently than on previous versions of RHEL.
Consequence:
If the predicate was used, `find` provided unexpected results.
Fix:
The documentation of find has been updated to discourage users from using this predicate. Additionally, `find` prints a warning message if the deprecated predicate is used.
Result:
Users are not confused by the results when using the deprecated predicate.
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2015-11-19 09:24:06 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Attachments: |
Description
Tetsuo Handa
2014-07-04 04:39:15 UTC
This syntax is deprecated and it is not supposed to be used. The upstream fix was to remove the old syntax completely and fail with error if someone still uses it. I am not going to apply the fix on RHEL-7 because some scripts may already depend on the _current_ behavior. Fedora is the right place where such changes happen. See bug #982503 for details. Thank you. I read the discussion. Changing behavior without man page updates and runtime warning is very bad. Indeed there may be scripts which already depend on the current behavior, but such scripts should use `-perm omode' rather than `-perm +omode' because `-perm +omode' is no longer supported in findutils 4.5.12. There will be scripts which depend on the previous behavior, and such scripts should be updated to use `-perm /omode' rather than `-perm +omode'. Therefore, I think we want some runtime warning like below. fprintf(stderr, "warning: You are using `-perm +omode'. But it had been deprecated since findutils 4.2.21, changed behavior in 4.5.11, and was removed in 4.5.12.\nPlease use `-perm /omode' if you want the old behavior and use `-perm omode' if you want the new behavior.\n"); Sounds like a good idea. We can implement the run-time warning and update the documentation (once approved by Product Management). Created attachment 916789 [details]
[PATCH] Resolves: #1116237 - find -perm +numeric does not work as expected
Thank you. Regarding your patch, is printing you are using `-perm +omode'. ^^^^^ for symbolic modes like $ find /tmp/file -perm +u+x intentional? Created attachment 917049 [details] [PATCH v2] Resolves: #1116237 - find -perm +numeric does not work as expected (In reply to Tetsuo Handa from comment #7) > Thank you. Regarding your patch, is printing > > you are using `-perm +omode'. > ^^^^^ > for symbolic modes like > > $ find /tmp/file -perm +u+x > > intentional? Good catch! Of course, it was not. Please find the updated patch that uses a more precise condition for printing the warning. I tested three versions (RHEL6 / RHEL7 / upstream). ---------- find (GNU findutils) 4.4.2 ---------- $ touch /tmp/file $ chmod 100 /tmp/file $ find /tmp/file -perm +100 /tmp/file $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 111 /tmp/file $ find /tmp/file -perm +100 /tmp/file $ find /tmp/file -perm +u+x /tmp/file $ find /tmp/file -perm /u+x /tmp/file $ chmod 700 /tmp/file $ find /tmp/file -perm +100 /tmp/file $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 755 /tmp/file $ find /tmp/file -perm +100 /tmp/file $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file ---------- find (GNU findutils) 4.4.2 ---------- ---------- find (GNU findutils) 4.5.11 (with your patch) ---------- $ touch /tmp/file $ chmod 100 /tmp/file $ find /tmp/file -perm +100 find: warning: you are using `-perm +MODE'. The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. /tmp/file $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 111 /tmp/file $ find /tmp/file -perm +100 find: warning: you are using `-perm +MODE'. The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. $ find /tmp/file -perm +u+x /tmp/file $ find /tmp/file -perm /u+x /tmp/file $ chmod 700 /tmp/file $ find /tmp/file -perm +100 find: warning: you are using `-perm +MODE'. The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 755 /tmp/file $ find /tmp/file -perm +100 find: warning: you are using `-perm +MODE'. The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file ---------- find (GNU findutils) 4.5.11 (with your patch) ---------- ---------- find (GNU findutils) 4.5.13-git (as of commit 00864c7e7f) ---------- $ touch /tmp/file $ chmod 100 /tmp/file $ find /tmp/file -perm +100 find: invalid mode ‘+100’ $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 111 /tmp/file $ find /tmp/file -perm +100 find: invalid mode ‘+100’ $ find /tmp/file -perm +u+x /tmp/file $ find /tmp/file -perm /u+x /tmp/file $ chmod 700 /tmp/file $ find /tmp/file -perm +100 find: invalid mode ‘+100’ $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file $ chmod 755 /tmp/file $ find /tmp/file -perm +100 find: invalid mode ‘+100’ $ find /tmp/file -perm +u+x $ find /tmp/file -perm /u+x /tmp/file ---------- find (GNU findutils) 4.5.13-git (as of commit 00864c7e7f) ---------- It seems to me that `-perm +omode' case was removed in 4.5.12 but `-perm +symbolic' case remains supported in 4.5.12. Also, for those who use `-perm +omode' in 4.5.11 with expecting the behavior of 4.5.11, printing `-perm +MODE' does not work as expected in findutils-4.5.11 is confusing. Should we change The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. to something like The interpretation of `-perm +omode' changed in findutils-4.5.11. The syntax `-perm +omode' was removed in findutils-4.5.12, in favour of `-perm /omode'. ? Created attachment 917885 [details] [PATCH v3] Resolves: #1116237 - find -perm +numeric does not work as expected > It seems to me that `-perm +omode' case was removed in 4.5.12 > but `-perm +symbolic' case remains supported in 4.5.12. Yes, that is the current upstream behavior. > Also, for those who use `-perm +omode' in 4.5.11 with expecting the > behavior of 4.5.11, printing > > `-perm +MODE' does not work as expected in findutils-4.5.11 > > is confusing. > > Should we change > > The syntax `-perm +MODE' does not work as expected in findutils-4.5.11 > and it was removed in findutils-4.5.12, in favour of `-perm /MODE'. > > to something like > > The interpretation of `-perm +omode' changed in findutils-4.5.11. > The syntax `-perm +omode' was removed in findutils-4.5.12, in favour of > `-perm /omode'. > > ? Sounds good. I have updated the patch per your suggestion. Thanks! Looks OK to me. Thank you. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2099.html |