summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2022-03-07 23:29:20 +0000
committerPádraig Brady <P@draigBrady.com>2022-03-07 23:33:21 +0000
commit92cb8427c537f37edd43c5cef1909585201372ab (patch)
tree93d2c38127e5664ed960bf009a66fbc65228fcf3
parent85c975df2c25bd799370b04bb294e568e001102f (diff)
downloadcoreutils-92cb8427c537f37edd43c5cef1909585201372ab.tar.gz
stat: only automount with --cached=never
Revert to the default behavior before the introduction of statx(). * src/stat.c (do_stat): Set AT_NO_AUTOMOUNT without --cached=never. * doc/coreutils.texi (stat invocation): Mention the automount behavior with --cached=never. * NEWS: Mention the change in behavior. Fixes https://bugs.gnu.org/54287
-rw-r--r--NEWS4
-rw-r--r--doc/coreutils.texi1
-rw-r--r--src/stat.c3
3 files changed, 8 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index a3442c5dd..fe66f496f 100644
--- a/NEWS
+++ b/NEWS
@@ -78,6 +78,10 @@ GNU coreutils NEWS -*- outline -*-
ls no longer tries to automount files, reverting to the behavior
before the statx() call was introduced in coreutils-8.32.
+ stat no longer tries to automount files by default, reverting to the
+ behavior before the statx() call was introduced in coreutils-8.32.
+ Only `stat --cached=never` will continue to automount files.
+
timeout --foreground --kill-after=... will now exit with status 137
if the kill signal was sent, which is consistent with the behavior
when the --foreground option is not specified. This allows users to
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index e9be0993a..05dc5ee21 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -12608,6 +12608,7 @@ Always read the already cached attributes if available.
@item never
Always sychronize with the latest file system attributes.
+This also mounts automounted files.
@item default
Leave the caching behavior to the underlying file system.
diff --git a/src/stat.c b/src/stat.c
index edafd0285..3765a8f65 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -1394,6 +1394,9 @@ do_stat (char const *filename, char const *format, char const *format2)
else if (force_sync)
flags |= AT_STATX_FORCE_SYNC;
+ if (! force_sync)
+ flags |= AT_NO_AUTOMOUNT;
+
fd = statx (fd, pathname, flags, format_to_mask (format), &stx);
if (fd < 0)
{