On 10/03/2022 07:44, Andreas Schwab wrote:
On Mär 09 2022, Paul Eggert wrote:
I audited gnulib's uses of fstatat and found one fishy one that doesn't
use AT_NO_AUTOMOUNT, namely, in fts.c where the follow-symlink branch uses
'stat' whereas the no-follow-symlink branch uses fstatat without
AT_NO_AUTOMOUNT. I installed the first patch to cause it be consistent in
using AT_NO_AUTOMOUNT, which is also consistent with what glibc does
??? In glibc, stat is the same as fstatat(,,,0).
Indeed. It looks like the man page for fstatat is out of date.
After looking at the kernel code, it seems that:
fstatat() did _not_ imply AT_NO_AUTOMOUNT from 2.6.38 -> 4.11
I'm not sure it even honored the AT_NO_AUTOMOUNT flag before 4.11
fstatat() did imply AT_NO_AUTOMOUNT since 4.11
The attached patch clarifies this is the fstatat and statx man pages.
sorry for the confusion,
Pádraig
From d5c356f18b18cceb245ae9df175322760f32fb2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@xxxxxxxxxxxxxx>
Date: Thu, 10 Mar 2022 13:37:11 +0000
Subject: [PATCH] fix descriptions for AT_NO_AUTOMOUNT
Don't mention AT_NO_AUTOMOUNT for fstatat.2
as it's implied since v4.11-rc7-14-gdeccf497d804
Don't mention commit v4.13-9318-g42f461482178 as it was reverted
Mention that stat(), lstat(), and fstatat()
imply AT_NO_AUTOMOUNT, on the statx.2 man page
---
man2/stat.2 | 31 -------------------------------
man2/statx.2 | 18 +++++++++++++++---
2 files changed, 15 insertions(+), 34 deletions(-)
diff --git a/man2/stat.2 b/man2/stat.2
index 016c1f47d..43ab5b777 100644
--- a/man2/stat.2
+++ b/man2/stat.2
@@ -317,37 +317,6 @@ This flag is Linux-specific; define
.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
to obtain its definition.
.TP
-.BR AT_NO_AUTOMOUNT " (since Linux 2.6.38)"
-Don't automount the terminal ("basename") component of
-.I pathname
-if it is a directory that is an automount point.
-This allows the caller to gather attributes of an automount point
-(rather than the location it would mount).
-Since Linux 4.14,
-.\" commit 42f46148217865a545e129612075f3d828a2c4e4
-also don't instantiate a nonexistent name in an
-on-demand directory such as used for automounter indirect maps.
-This
-flag has no effect if the mount point has already been mounted over.
-.IP
-Both
-.BR stat ()
-and
-.BR lstat ()
-act as though
-.B AT_NO_AUTOMOUNT
-was set.
-.IP
-The
-.B AT_NO_AUTOMOUNT
-can be used in tools that scan directories
-to prevent mass-automounting of a directory of automount points.
-.IP
-This flag is Linux-specific; define
-.B _GNU_SOURCE
-.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
-to obtain its definition.
-.TP
.B AT_SYMLINK_NOFOLLOW
If
.I pathname
diff --git a/man2/statx.2 b/man2/statx.2
index 04b3e5075..d4e638756 100644
--- a/man2/statx.2
+++ b/man2/statx.2
@@ -195,11 +195,23 @@ Don't automount the terminal ("basename") component of
if it is a directory that is an automount point.
This allows the caller to gather attributes of an automount point
(rather than the location it would mount).
-This flag can be used in tools that scan directories
-to prevent mass-automounting of a directory of automount points.
+This
+flag has no effect if the mount point has already been mounted over.
+.IP
The
.B AT_NO_AUTOMOUNT
-flag has no effect if the mount point has already been mounted over.
+flag can be used in tools that scan directories
+to prevent mass-automounting of a directory of automount points.
+.IP
+All of
+.BR stat () ,
+.BR lstat () ,
+and
+.BR fstatat ()
+act as though
+.B AT_NO_AUTOMOUNT
+was set.
+.IP
This flag is Linux-specific; define
.B _GNU_SOURCE
.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed
--
2.31.1