From a9c199ed75fdd2e3948da9cc9a6bfffe458a3443 Mon Sep 17 00:00:00 2001 From: Bernhard Voelker Date: Mon, 8 Oct 2018 16:45:36 -0700 Subject: [PATCH] fts: remove FTS_NOATIME This reverts commit da4d6974013c822af1498941e32db774b2031765. We cannot guarantee that O_NOATIME works: e.g. openat fails with EPERM if the effective user ID of the caller does not match the owner of the file and the caller is not privileged. Downstream findutils has never picked up FTS_NOATIME. Discussed at . * lib/fts_.h (FTS_NOATIME): Remove bit flag. (FTS_OPTIONMASK): Adjust. * lib/fts.c (diropen, fts_open, fts_build): Likewise. (fd_ring_check): Likewise. --- ChangeLog | 14 ++++++++++++++ lib/fts.c | 11 ++++------- lib/fts_.h | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cc3d6a0f6..f49c41dcbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-10-08 Bernhard Voelker + + fts: remove FTS_NOATIME + This reverts commit da4d6974013c822af1498941e32db774b2031765. + We cannot guarantee that O_NOATIME works: e.g. openat fails + with EPERM if the effective user ID of the caller does not match + the owner of the file and the caller is not privileged. + Downstream findutils has never picked up FTS_NOATIME. Discussed at + . + * lib/fts_.h (FTS_NOATIME): Remove bit flag. + (FTS_OPTIONMASK): Adjust. + * lib/fts.c (diropen, fts_open, fts_build): Likewise. + (fd_ring_check): Likewise. + 2018-10-08 Bruno Haible csharpcomp*, csharpexec*: Remove support for pnet. diff --git a/lib/fts.c b/lib/fts.c index 1ccc78c116..aaa6bb2934 100644 --- a/lib/fts.c +++ b/lib/fts.c @@ -370,8 +370,7 @@ internal_function diropen (FTS const *sp, char const *dir) { int open_flags = (O_SEARCH | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK - | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0) - | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)); + | (ISSET (FTS_PHYSICAL) ? O_NOFOLLOW : 0)); int fd = (ISSET (FTS_CWDFD) ? openat (sp->fts_cwd_fd, dir, open_flags) @@ -426,8 +425,7 @@ fts_open (char * const *argv, early, doing it here saves us the trouble of ensuring later (where it'd be messier) that "." can in fact be opened. If not, revert to FTS_NOCHDIR mode. */ - int fd = open (".", - O_SEARCH | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)); + int fd = open (".", O_SEARCH); if (fd < 0) { /* Even if "." is unreadable, don't revert to FTS_NOCHDIR mode @@ -1304,8 +1302,7 @@ set_stat_type (struct stat *st, unsigned int dtype) (((ISSET(FTS_PHYSICAL) \ && ! (ISSET(FTS_COMFOLLOW) \ && cur->fts_level == FTS_ROOTLEVEL)) \ - ? O_NOFOLLOW : 0) \ - | (ISSET (FTS_NOATIME) ? O_NOATIME : 0)), \ + ? O_NOFOLLOW : 0)), \ Pdir_fd) /* @@ -1796,7 +1793,7 @@ fd_ring_check (FTS const *sp) int fd = i_ring_pop (&fd_w); if (0 <= fd) { - int open_flags = O_SEARCH | O_CLOEXEC | O_NOATIME; + int open_flags = O_SEARCH | O_CLOEXEC; int parent_fd = openat (cwd_fd, "..", open_flags); if (parent_fd < 0) { diff --git a/lib/fts_.h b/lib/fts_.h index 70cc9e3d67..6188122fd9 100644 --- a/lib/fts_.h +++ b/lib/fts_.h @@ -149,7 +149,7 @@ typedef struct { dirent.d_type data. */ # define FTS_DEFER_STAT 0x0400 -# define FTS_NOATIME 0x0800 /* use O_NOATIME during traversal */ +/* 0x0800 unused, was non-working FTS_NOATIME */ /* Use this flag to disable stripping of trailing slashes from input path names during fts_open initialization. */ -- 2.39.5