bugfindutils - Bugs: bug #29460, -printf %Y fails in $CWD-dependent...

 
 

bug #29460: -printf %Y fails in $CWD-dependent way

Submitter:  James Youngman <jay>
Submitted:  Wed 07 Apr 2010 09:16:17 AM UTC
   
 
Category:  find Severity:  4 - Important
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  jay
Originator Name:  Open/Closed:  Closed
Release:  4.5.7 Fixed Release:  4.5.8
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 07 Apr 2010 11:10:14 PM UTC, comment #3: 

Fixed in 4.5.8, which I just released.

James Youngman <jay>
Group administrator
Wed 07 Apr 2010 09:58:05 AM UTC, comment #2: 

I've updated the patch to mention the bugfix in the NEWS file.  I also changed a similar case in symlink_loop.

(file #20149, file #20150)

James Youngman <jay>
Group administrator
Wed 07 Apr 2010 09:21:45 AM UTC, comment #1: 

The attached patch fixes the problem (and introduces a regression test case for it).

(file #20148)

James Youngman <jay>
Group administrator
Wed 07 Apr 2010 09:16:17 AM UTC, original submission:  

This problem was diagnosed as a result of a wrongly-prepared initrd, meaning that the original Debian bug starts off with a lot of apparently-irrelevant material.   However, the centre of the issue is this:

"""
Apparently it is affected by CWD:

14:21 ~$ cd -
/tmp
14:21 tmp$ find /tmp -name sleep  -printf %Y\\n
f
f
14:21 tmp$ cd -
/home/jidanni
14:21 ~$ find /tmp -name sleep  -printf %Y\\n
N
N
14:21 ~$ cd -
/tmp
14:22 tmp$ find /tmp -name sleep  -printf %Y\\n
f
f
14:22 tmp$ mount|egrep /home\|/tmp
/dev/hda6 on /home type ext3 (rw)
tmpfs on /tmp type tmpfs (rw)
"""

Here we see that the result of %Y depends on the original choice of $CWD.

The problem is that find (ftsfind, not oldfind) is calling either stat or lstat to determine the result of %Y.   Since neither of these pay attention to state.cwd_dir_fd, they will often fail to locate the file being examined and hence produce 'N', wrongly.


James Youngman <jay>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #20149:  0001-Fix-Savannah-bug-29460-printf-Y-fails-in-CWD-depende.patch added by jay (5KiB - text/x-patch - Replacement patch (it also updates the NEWS file))
file #20150:  0002-More-stat-xstat-cleanup.patch added by jay (2KiB - text/x-patch - Replacement patch (it also updates the NEWS file))

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-04-07 jay StatusCode Review Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.5.8
    2010-04-07 jay Attached File- Added 0001-Fix-Savannah-bug-29460-printf-Y-fails-in-CWD-depende.patch, #20149
        Attached File- Added 0002-More-stat-xstat-cleanup.patch, #20150
    2010-04-07 jay Attached File#20148 Removed
    2010-04-07 jay Attached File- Added 0001-Fix-Savannah-bug-29460-printf-Y-fails-in-CWD-depende.patch, #20148
        StatusConfirmed Code Review

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code