[Top][All Lists]

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

fts: find -xdev, FTS_XDEV and POSIX issue http://austingroupbugs.net/vie

From: James Youngman
Subject: fts: find -xdev, FTS_XDEV and POSIX issue http://austingroupbugs.net/view.php?id=1133
Date: Sun, 5 May 2019 19:26:44 +0100

Eric mailed the findutils list a while back to point out that POSIX
will standardise a new  -mount option for find which is similar to
-xdev but differs in the way the mount point itself is handled.  I
believe that the POSIX nftw() library function also gets a new option

Somewhat confusingly, System V did not behave in the way described in
the POSIX standard.

See for some additional background info:
  http://austingroupbugs.net/view.php?id=1133 (the POSIX issue about
differing -xdev interpretations)
  https://savannah.gnu.org/bugs/?54745 (Eric's heads-up about that for
  https://savannah.gnu.org/bugs/index.php?42318 (an older but related
bug report)

Currently, find accepts the -xdev option and to implement this simply
passes FTS_XDEV to fts().

Do the gnulib maintainers feel that the creation of the
FTW_MOUNT/FTW_XDEV dichotomy in POSIX nftw() justifies an analogous
thing in fts()?

I think it's possible that there would be no efficiency consideration
for find in particular, as GNU find will currently stat almost all the
directories it searches in any case (from ftsfind.c):

  isdir = S_ISDIR(mode)
    || (FTS_D  == ent->fts_info)
    || (FTS_DP == ent->fts_info)
    || (FTS_DC == ent->fts_info);

  if (isdir && (ent->fts_info == FTS_NSOK))
      /* This is a directory, but fts did not stat it, so
       * presumably would not be planning to search its
       * children.  Force a stat of the file so that the
       * children can be checked.
      fts_set (p, ent, FTS_AGAIN);

One of the key difficulties for findutils would be testing; we can't
create mount points in the regression tests, and selecting an
already-existing one to use for a test seems a tricky proposition.


reply via email to

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