]> Savannah Git Hosting - gnulib.git/commitdiff
fts: remove FTS_NOATIME
authorBernhard Voelker <mail@bernhard-voelker.de>
Mon, 8 Oct 2018 23:45:36 +0000 (16:45 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 8 Oct 2018 23:56:44 +0000 (16:56 -0700)
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
<https://lists.gnu.org/r/bug-gnulib/2018-09/msg00122.html>.
* 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
lib/fts.c
lib/fts_.h

index 3cc3d6a0f62b353b56d55e875c2e131eed4a5eef..f49c41dcbe11760543e4dceabde2df066db514d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2018-10-08  Bernhard Voelker  <mail@bernhard-voelker.de>
+
+       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
+       <https://lists.gnu.org/r/bug-gnulib/2018-09/msg00122.html>.
+       * 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  <bruno@clisp.org>
 
        csharpcomp*, csharpexec*: Remove support for pnet.
index 1ccc78c116c034dfb093689493242ee40bb7b402..aaa6bb293494783428c4545b9e5209132442827a 100644 (file)
--- 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)
             {
index 70cc9e3d67d362c9e4469878765128b0a0e1842b..6188122fd901cdbfe26284b8f73c93ffac4f4996 100644 (file)
@@ -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.  */