bugfindutils - Bugs: bug #14748, find -perm /zzz gives wrong result...

 
 

bug #14748: find -perm /zzz gives wrong result when zzz evaluates to an all-zero mask

Submitted by:  James Youngman <jay>
Submitted on:  Sat 08 Oct 2005 06:25:57 AM UTC  
 
Category:  find Severity:  3 - Normal
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  James Youngman <jay>
Originator Name:  Eric Blake Open/Closed:  Closed
Release:  4.2.25 Fixed Release:  4.3.3

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 07 Jan 2007 07:43:40 PM UTC, comment #5: 

I have now completed the change (in the CVS code for findutils 4.3.x).  A warning is still issued but it describes the recent functionality change (instead of warning about a future change).  Patch also attached.

(file #11692)

James Youngman <jay>
Project AdministratorIn charge of this item.
Sun 04 Dec 2005 02:35:23 AM UTC, comment #4: 

Future releases of find 4.2.x will issue a warning message when users do this (the warning goes to stderr and is issued unconditionally when this happens).

We're proposing to change the behaviour of a GNU extension and users could be forgiven for making assumptions after trying '-perm /000' since the documentation never explained what was supposed to happen with it.

Hence we'll issue a warning of future changes for now, and probably change the actual behaviour in the 4.3.x release series early next year. 

Please nag me to actually make the change in February 2006 if I haven't done so already.

James Youngman <jay>
Project AdministratorIn charge of this item.
Wed 30 Nov 2005 01:39:02 PM UTC, comment #3: 

Think of the converse, using the same example as before.  What does "! -perm /000" match?
"! -perm -+x" matches all files where any x bit is clear, or 000 and 100.
"! -perm /+x" matches all files where all x bits are clear, or 000.
Therefore,
"! -perm --x" matches all files where any bits in the mask are clear (there are no bits), or nothing at all (good, that was the opposite of "-perm --x" matching everything).
"! -perm /-x" matches all files where all bits in the mask are clear (there are no bits), or nothing at all.

I still argue that -perm --x and -perm /-x should be identical.

Eric Blake <ericb>
Project Administrator
Wed 30 Nov 2005 06:21:02 AM UTC, comment #2: 

Looking at this again, I'm not completely convinced.  If no bits are set in the specified mask, none of the bits set in the mask can be set in the file's mode (since there are no set bits).  Hence one could argue that "-perm /000" should never match any files, in other words that the current behaviour is correct. Thoughts?

James Youngman <jay>
Project AdministratorIn charge of this item.
Sat 08 Oct 2005 06:27:24 AM UTC, comment #1: 

Eric also writes:-

$ touch 000 100 111 777
$ for f in * ; do touch $f $f ; done
^^^^^
Obviously, that should be a chmod.

James Youngman <jay>
Project AdministratorIn charge of this item.
Sat 08 Oct 2005 06:25:57 AM UTC, original submission:  

This bug report has been split out from part of a discussion of an earlier problem.  In a discussion about bug #14619, Eric Blake writes:-

I have, however, found a bug in 4.2.25:

$ touch 000 100 111 777
$ for f in * ; do touch $f $f ; done
$ find . -perm --x
.
./000
./100
./111
./777
$ find . -perm +-x
./000
$ find . -perm /-x
$

The first two are correct. --x means use mode "-x", which maps to the template 0000, and find all files that have all set bits in the template set on the file (no bits meet this criteria), without regard to the state of any bit cleared in the template (ie, every file should match). +-x means use mode "+-x", which maps to the template 0000, and do an exact match (only ./000 has all permissions cleared).

However, /-x means use mode "-x", and find all files that have any set bit in the template set on the file (no bits meet this criteria), without regard to the state of any bit cleared in the template (ie, every file should match). So the bug is that /-x should behave like --x, but did not.

James Youngman <jay>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #11692:  sv-bug-14748.patch added by jay (6KiB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jay (Updated the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-04-15 jay Open/ClosedOpen => Closed
        Fixed ReleaseNone => 4.3.3
    2007-01-07 jay Attached File- => Added sv-bug-14748.patch, #11692
        StatusPostponed => Fixed
    2005-12-04 jay StatusNone => Postponed
    2005-10-08 jay Item GroupNone => Wrong result

    Back to the top


    Powered by Savane 3.5