bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #19806] Predicate -samefile potentially fooled by inode reuse


From: James Youngman
Subject: [bug #19806] Predicate -samefile potentially fooled by inode reuse
Date: Sat, 05 May 2007 12:25:55 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20060830 Firefox/1.5.0.7 (Debian-1.5.dfsg+1.5.0.7-2)

URL:
  <http://savannah.gnu.org/bugs/?19806>

                 Summary: Predicate -samefile potentially fooled by inode
reuse
                 Project: findutils
            Submitted by: jay
            Submitted on: Saturday 05/05/2007 at 12:25
                Category: None
                Severity: 2 - Minor
              Item Group: Wrong result
                  Status: None
                 Privacy: Public
             Assigned to: jay
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: None
           Fixed Release: None

    _______________________________________________________

Details:

The -samefile predicate checks the identity of a candidate file against the
identity of a reference file on the command line.  They are deemed to be the
same if they have the same inode and device numbers.  

This test can be fooled if the reference file is deleted after find starts
and the indoe number is reused for a new file.  The find program can
erroneously believe that the new file bearing the same inode number is in
fact the same file as the original reference file.   This causes -samefile to
produce false positives.

To fix this, we should hold a file descriptor open on the reference file
(unless it is a symbolic link and the -P option is active).  That will
prevent reuse of the inode number.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?19806>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]