bug-findutils
[Top][All Lists]
Advanced

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

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


From: Bernhard Voelker
Subject: [bug #33724] Find command is changing the access time of directory
Date: Fri, 28 Sep 2018 22:08:48 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #3, bug #33724 (project findutils):

[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)
    _______________________________________________________

Additional Item Attachment:

File name: 0001-fts-opendirat-fall-back-to-O_NOATIME-in-case-of-EPER.patch
Size:2 KB


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?33724>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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