RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1116237 - find -perm +numeric does not work as expected
Summary: find -perm +numeric does not work as expected
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: findutils
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Filip Holec
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-04 04:39 UTC by Tetsuo Handa
Modified: 2016-04-18 10:27 UTC (History)
4 users (show)

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.
Clone Of:
Environment:
Last Closed: 2015-11-19 09:24:06 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
[PATCH] Resolves: #1116237 - find -perm +numeric does not work as expected (4.42 KB, patch)
2014-07-09 14:03 UTC, Kamil Dudka
no flags Details | Diff
[PATCH v2] Resolves: #1116237 - find -perm +numeric does not work as expected (4.53 KB, patch)
2014-07-10 12:04 UTC, Kamil Dudka
no flags Details | Diff
[PATCH v3] Resolves: #1116237 - find -perm +numeric does not work as expected (4.56 KB, patch)
2014-07-14 14:48 UTC, Kamil Dudka
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2099 0 normal SHIPPED_LIVE findutils update 2015-11-19 09:33:44 UTC

Description Tetsuo Handa 2014-07-04 04:39:15 UTC
Description of problem:

"find -perm +100" is by error interpreted as "find -perm 100",
silently breaking existing scripts which are not using "find -perm /100".


Version-Release number of selected component (if applicable):

findutils-4.5.11-3.el7


How reproducible:

100%


Steps to Reproduce:

1. Run the following commands.

----------
[user@localhost ~]$ touch /tmp/file
[user@localhost ~]$ chmod 100 /tmp/file
[user@localhost ~]$ find /tmp/file -perm 100
/tmp/file
[user@localhost ~]$ find /tmp/file -perm +100
/tmp/file
[user@localhost ~]$ find /tmp/file -perm /100
/tmp/file
[user@localhost ~]$ chmod 700 /tmp/file
[user@localhost ~]$ find /tmp/file -perm 100
[user@localhost ~]$ find /tmp/file -perm +100
[user@localhost ~]$ find /tmp/file -perm /100
/tmp/file
[user@localhost ~]$
----------

Actual results:

"find /tmp/file -perm +100" is interpreted as "find /tmp/file -perm 100".


Expected results:

"find /tmp/file -perm +100" is interpreted as "find /tmp/file -perm /100".


Additional info:

A result using findutils-4.4.2-6.el6 is shown below.

----------
[user@localhost ~]$ touch /tmp/file
[user@localhost ~]$ chmod 100 /tmp/file
[user@localhost ~]$ find /tmp/file -perm 100
/tmp/file
[user@localhost ~]$ find /tmp/file -perm +100
/tmp/file
[user@localhost ~]$ find /tmp/file -perm /100
/tmp/file
[user@localhost ~]$ chmod 700 /tmp/file
[user@localhost ~]$ find /tmp/file -perm 100
[user@localhost ~]$ find /tmp/file -perm +100
/tmp/file
[user@localhost ~]$ find /tmp/file -perm /100
/tmp/file
[user@localhost ~]$
----------

Comment 2 Kamil Dudka 2014-07-04 07:17:45 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.

Comment 3 Tetsuo Handa 2014-07-05 16:48:40 UTC
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");

Comment 4 Kamil Dudka 2014-07-09 13:36:53 UTC
Sounds like a good idea.  We can implement the run-time warning and update the documentation (once approved by Product Management).

Comment 5 Kamil Dudka 2014-07-09 14:03:19 UTC
Created attachment 916789 [details]
[PATCH] Resolves: #1116237 - find -perm +numeric does not work as  expected

Comment 7 Tetsuo Handa 2014-07-10 05:17:43 UTC
Thank you. Regarding your patch, is printing

  you are using `-perm +omode'.
                        ^^^^^
for symbolic modes like

  $ find /tmp/file -perm +u+x

intentional?

Comment 8 Kamil Dudka 2014-07-10 12:04:30 UTC
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.

Comment 9 Tetsuo Handa 2014-07-11 14:29:53 UTC
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'.

?

Comment 10 Kamil Dudka 2014-07-14 14:48:58 UTC
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!

Comment 11 Tetsuo Handa 2014-07-14 20:42:41 UTC
Looks OK to me. Thank you.

Comment 19 errata-xmlrpc 2015-11-19 09:24:06 UTC
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


Note You need to log in before you can comment on or make changes to this bug.