bugfindutils - Bugs: bug #33724, Find command is changing the...

 
 

bug #33724: Find command is changing the access time of directory

Submitted by:  Nitin Bhadauria <nbhadauria>
Submitted on:  Thu 07 Jul 2011 07:41:04 AM UTC  
 
Category:  find Severity:  3 - Normal
Item Group:  None Status:  Wont Fix
Privacy:  Public Assigned to:  Bernhard Voelker <berny>
Originator Name:  UNICON Open/Closed:  Closed
Release:  4.2.27 Fixed Release:  None

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

Thu 11 Oct 2018 10:23:14 PM UTC, comment #4: 

As discussed in [1] and [2], we can't properly ensure that O_NOATIME
works without surprises or side-effects on all systems and environments.

Consequently, we've removed the FTS_NOATIME option (which has never
been used) from gnulib.

Therefore, I'm hereby closing this issue as WONTFIX.

[1] https://lists.gnu.org/r/bug-findutils/2018-09/msg00052.html
[2] https://lists.gnu.org/r/bug-findutils/2018-10/msg00000.html

Bernhard Voelker <berny>
Project AdministratorIn charge of this item.
Sat 29 Sep 2018 02:08:48 AM UTC, comment #3: 

[CC-ing gnulib, in the hope they see the attachment as well.]

On Sun 01 Nov 2015 11:19:53 PM CET, James Youngman wrote:

> It looks like the FTS_NOATIME flag does what's needed.


Not quite: openat() returns with EPERM if:

  $ man openat | grep EPERM.*NOATIME
       EPERM  The O_NOATIME flag was specified, but the effective user ID of the caller \
              did not match the owner of the file and the caller was not privileged.

Indeed, when quickly adding FTS_NOATIME to ftsoptions in ftsfind.c for testing,
then strace in a directory not owned by the calling (non-root) user shows:

  openat(AT_FDCWD, ".", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_NOFOLLOW|O_NOATIME|O_CLOEXEC|O_DIRECTORY) = -1 EPERM (Operation not permitted)

and find issues an error diagnostic.

It seems that O_NOATIME cannot be used generally on directories.
Conversely it seems that the atime of such a directory is changed
without a problem.

The attached path makes FTS retry without O_NOATIME in such a case
which seems to be the best choice we currently have.
Once this is working in FTS, we need to decide how to enable/disable
the NOATIME behaviour in find(1), as POSIX requires this per default.

WDYT?

Have a nice day,
Berny

(file #45115)

Bernhard Voelker <berny>
Project AdministratorIn charge of this item.
Sun 01 Nov 2015 10:19:53 PM UTC, comment #2: 

It looks like the FTS_NOATIME flag does what's needed.

James Youngman <jay>
Project Administrator
Thu 07 Jul 2011 01:10:15 PM UTC, comment #1: 

POSIX requires this behavior.  However, Linux provides the O_NOATIME flag to open() to work around this behavior - so the obvious conclusion is that find should support the option of requesting the use of the O_NOATIME flag.   It can't be on by default, but certainly makes sense to support it where possible.

Eric Blake <ericb>
Project Administrator
Thu 07 Jul 2011 07:41:04 AM UTC, original submission:  

I am using find command to find directory not been accessed from 90 days.
for first time it works fine then i found it change the access time of folder.

ex.

[root@mail ~]# date
Thu Jul  7 13:01:45 IST 2011

[root@mail ~]# stat find /mailbox/vmail/nbhadauria/Maildir/cur
stat: cannot stat `find': No such file or directory
  File: `/mailbox/vmail/nbhadauria/Maildir/cur'
  Size: 581632    Blocks: 1152       IO Block: 4096   directory
Device: 811h/2065d Inode: 15433801    Links: 2
Access: (0700/drwx------)  Uid: (11184/   vmail)   Gid: ( 2110/   vmail)
Access: 2011-07-07 13:00:46.000000000 +0530
Modify: 2011-07-07 12:49:46.000000000 +0530
Change: 2011-07-07 12:49:46.000000000 +0530

[root@mail ~]# find /mailbox/vmail/*/Maildir/cur -type d -atime +90 -print

[root@mail ~]# stat find /mailbox/vmail/nbhadauria/Maildir/cur
stat: cannot stat `find': No such file or directory
  File: `/mailbox/vmail/nbhadauria/Maildir/cur'
  Size: 581632    Blocks: 1152       IO Block: 4096   directory
Device: 811h/2065d Inode: 15433801    Links: 2
Access: (0700/drwx------)  Uid: (11184/   vmail)   Gid: ( 2110/   vmail)
Access: 2011-07-07 13:05:56.000000000 +0530
Modify: 2011-07-07 12:49:46.000000000 +0530
Change: 2011-07-07 12:49:46.000000000 +0530

[root@mail ~]# date
Thu Jul  7 13:06:22 IST 2011

As you can see The Access time is changed..

Nitin Bhadauria <nbhadauria>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #45115:  0001-fts-opendirat-fall-back-to-O_NOATIME-in-case-of-EPER.patch added by berny (3KiB - text/x-patch - [PATCH] fts: opendirat: fall back to ~O_NOATIME in case of EPERM)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by berny (Updated the item)
  • -email is unavailable- added by berny
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by ericb (Posted a comment)
  • -email is unavailable- added by nbhadauria (Submitted 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
    2018-10-11 berny StatusNone => Wont Fix
        Assigned tojay => berny
        Open/ClosedOpen => Closed
    2018-09-29 berny Attached File- => Added 0001-fts-opendirat-fall-back-to-O_NOATIME-in-case-of-EPER.patch, #45115
        Carbon-Copy- => Added bug-gnulib@gnu.org
    2015-11-01 jay Assigned toNone => jay

    Back to the top


    Powered by Savane 3.5