]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
stat: only automount with --cached=never
authorPádraig Brady <P@draigBrady.com>
Mon, 7 Mar 2022 23:29:20 +0000 (23:29 +0000)
committerPádraig Brady <P@draigBrady.com>
Mon, 7 Mar 2022 23:33:21 +0000 (23:33 +0000)
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

NEWS
doc/coreutils.texi
src/stat.c

diff --git a/NEWS b/NEWS
index a3442c5dd794cdee95141f7eb1228768da2af953..fe66f496f66ce42bec4892835d3ef79db983e619 100644 (file)
--- 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
index e9be0993ac8cf3c18854585585a6e0c906dbc9ca..05dc5ee21f9515e974a529c2d6b7ecfeadb4331e 100644 (file)
@@ -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.
index edafd028544f0219dc75f4c7878dfad4501c22e6..3765a8f65a433e7213a7ce2119636ad9c6584863 100644 (file)
@@ -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)
     {