Skip to contentSkip to conversation

fix descriptions for AT_NO_AUTOMOUNT

PATCH In review Pádraig Brady 3 participants 10 messages Mar 10, 2022 – Mar 14, 2022 9 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

PATCH 1/1 fix descriptions for AT_NO_AUTOMOUNT

Quoted 9 lines · Andreas Schwab
Quoted 5 lines · Paul Eggert

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?= <[email protected]>
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(-)
man2/stat.2 +0 -31
index 016c1f47d..43ab5b777 100644
@@ -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
man2/statx.2 +15 -3
index 04b3e5075..d4e638756 100644
@@ -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
Signature · 1 line
2.31.1
#10 lore raw
Quoted 4 lines · Pádraig Brady

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

Ouch, so this whole thing has been a false alarm? Well, in some sense that's a relief; in another sense I wonder whether we should undo some of the recent Gnulib changes.

#11 lore raw
In reply to Pádraig Brady

[Added a few CCs from the relevant kernel commits]

Hi Pádraig,

Quoted 19 lines · Pádraig Brady
Quoted 11 lines · Andreas Schwab
Quoted 7 lines · Paul Eggert

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

Quoted 4 lines

The attached patch clarifies this is the fstatat and statx man pages.

sorry for the confusion,
Pádraig

---

Quoted 4 lines

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

Even though it's implied, since code may pass it, and especially code written based on the old manual page, it would be good to keep the paragraph in fstatat.2, even if the text is replaced by something like "Before Linux x.xx, this flag was ignored.
After Linux y.yy, this flag is implied."

Does it make sense to you?

Quoted 2 lines

Don't mention commit v4.13-9318-g42f461482178 as it was reverted

Please also mention v4.15-rc1-50-g5d38f049cee1 as the commit in which it was reverted.
Since it was present in some kernel releases, we might want to mention it in the manual page?

Quoted 3 lines

Mention that stat(), lstat(), and fstatat()
imply AT_NO_AUTOMOUNT, on the statx.2 man page

Please sign the patch with "Signed-off-by: ..."
<https://www.kernel.org/doc/man-pages/patches.html>

Quoted 58 lines
---
 man2/stat.2  | 31 -------------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 15 insertions(+), 34 deletions(-)
man2/stat.2 +0 -31
index 016c1f47d..43ab5b777 100644
@@ -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
man2/statx.2 +1 -2
index 04b3e5075..d4e638756 100644
@@ -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

man2/statx.2 Don't automount the terminal ("basename") component of · line 207

Quoted 10 lines
man2/statx.2 +7 -1
+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 () ,

s/() ,/(2),/

See man-pages(7) for when to put a number and when not:
Formatting conventions for manual pages describing functions
[...]

Any reference to the subject of the current manual page should be written with the name in bold followed by a pair of parentheses in Roman (normal) font. For example, in the fcntl(2) man page, references to the subject of the page would be written as: fcntl(). The preferred way to write this in the source file is:

.BR fcntl ()

man2/statx.2 Don't automount the terminal ("basename") component of · line 208

Quoted 1 line
man2/statx.2 +1 -0
+.BR lstat () ,

same

man2/statx.2 Don't automount the terminal ("basename") component of · line 210

Quoted 2 lines
man2/statx.2 +2 -0
+and
+.BR fstatat ()

s/()/(2)/

Quoted 10 lines
man2/statx.2 +4 -0
+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
Signature · 1 line
2.31.1

Thanks,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#12 lore raw
Quoted 36 lines · Alejandro Colomar (man-pages)

[Added a few CCs from the relevant kernel commits]

Hi Pádraig,

Quoted 19 lines · Pádraig Brady
Quoted 11 lines · Andreas Schwab
Quoted 7 lines · Paul Eggert

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

Quoted 4 lines

The attached patch clarifies this is the fstatat and statx man pages.

sorry for the confusion,
Pádraig

---

Quoted 4 lines

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

Quoted 8 lines

Even though it's implied, since code may pass it, and especially code written based on the old manual page, it would be good to keep the paragraph in fstatat.2, even if the text is replaced by something like "Before Linux x.xx, this flag was ignored.
After Linux y.yy, this flag is implied."

Does it make sense to you?

Yes good point.
I went through the git history and the summary is fstatat() honored the flag since 2.6.38,
ignored the flag since 3.1,
implied the flag since 4.11,

I'll add that info to fstatat(2), and the details to the commit message.

Quoted 6 lines
Quoted 1 line

Don't mention commit v4.13-9318-g42f461482178 as it was reverted

Please also mention v4.15-rc1-50-g5d38f049cee1 as the commit in which it was reverted.
Since it was present in some kernel releases, we might want to mention it in the manual page?

Well since the flag for fstatat() doesn't change anything since 3.1 it's probably best not to mention this old, short lived, and very specific info.

Quoted 5 lines
Quoted 2 lines

Mention that stat(), lstat(), and fstatat()
imply AT_NO_AUTOMOUNT, on the statx.2 man page

Please sign the patch with "Signed-off-by: ..."
<https://www.kernel.org/doc/man-pages/patches.html>

Done in the attached.

thanks!
Pádraig

From f45367d494d9e97fa8a18d8e477e1facf259688c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Thu, 10 Mar 2022 13:37:11 +0000
Subject: [PATCH] fix descriptions for AT_NO_AUTOMOUNT
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

fstatat(..., AT_NO_AUTOMOUNT) has had the following history in Linux:
v2.6.37-7314-g6f45b65672c8
add AT_NO_AUTOMOUNT and fstatat honors it
v3.1-rc7-68-gb6c8069d3577
ignore AT_NO_AUTOMOUNT since default operation now less eagerly mounts
v4.10-11255-ga528d35e8bfc
adds statx which reinstated 2.6.38 behavior for fstatat (not released)
v4.11-rc7-14-gdeccf497d804
adjust fstatat so that AT_NO_AUTOMOUNT always specified (to statx)

* man2/stat.2:
Adjust AT_NO_AUTOMOUNT description for fstatat.2 as per the above, to indicate AT_NO_AUTOMOUNT should be avoided with fstatat() since it's ignored since 3.1 and implied since 4.11.

Don't mention commit v4.13-9318-g42f461482178 as it was reverted, and moot anyway since we can't adjust AT_NO_AUTOMOUNT since 3.1.

* man2/statx.2:
Mention that stat(), lstat(), and fstatat() imply AT_NO_AUTOMOUNT.

---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 31 deletions(-)
man2/stat.2 +3 -28
index 016c1f47d..9000b2ca6 100644
@@ -319,34 +319,9 @@ 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.
+.I pathname.
+Since Linux 3.1 this flag is ignored.
+Since Linux 4.11 this flag is implied.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
man2/statx.2 +15 -3
index 04b3e5075..d4e638756 100644
@@ -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
Signature · 1 line
2.31.1
#13 lore raw
Quoted 26 lines · Pádraig Brady
Quoted 6 lines · Alejandro Colomar (man-pages)
Quoted 4 lines · Pádraig Brady

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

Quoted 8 lines

Even though it's implied, since code may pass it, and especially code written based on the old manual page, it would be good to keep the paragraph in fstatat.2, even if the text is replaced by something like "Before Linux x.xx, this flag was ignored.
After Linux y.yy, this flag is implied."

Does it make sense to you?

Yes good point.
I went through the git history and the summary is fstatat() honored the flag since 2.6.38,
ignored the flag since 3.1,
implied the flag since 4.11,

I'll add that info to fstatat(2), and the details to the commit message.

Quoted 2 lines
Quoted 1 line

Don't mention commit v4.13-9318-g42f461482178 as it was reverted

Quoted 8 lines
Quoted 4 lines

Please also mention v4.15-rc1-50-g5d38f049cee1 as the commit in which it was reverted.
Since it was present in some kernel releases, we might want to mention it in the manual page?

Well since the flag for fstatat() doesn't change anything since 3.1 it's probably best not to mention this old, short lived, and very specific info.

Okay.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Mention that stat(), lstat(), and fstatat()
imply AT_NO_AUTOMOUNT, on the statx.2 man page

Please sign the patch with "Signed-off-by: ..."
<https://www.kernel.org/doc/man-pages/patches.html>

Done in the attached.

Please send the patch inline (or both inline and attached), if you don't mind.
However, if it's a big hassle for you,
I can apply it from an attachment.

Quoted 3 lines

thanks!
Pádraig

---

Quoted 18 lines

Subject: [PATCH] fix descriptions for AT_NO_AUTOMOUNT

fstatat(..., AT_NO_AUTOMOUNT) has had the following history in Linux:
v2.6.37-7314-g6f45b65672c8
add AT_NO_AUTOMOUNT and fstatat honors it
v3.1-rc7-68-gb6c8069d3577
ignore AT_NO_AUTOMOUNT since default operation now less eagerly mounts
v4.10-11255-ga528d35e8bfc
adds statx which reinstated 2.6.38 behavior for fstatat (not released)
v4.11-rc7-14-gdeccf497d804
adjust fstatat so that AT_NO_AUTOMOUNT always specified (to statx)

* man2/stat.2:
Adjust AT_NO_AUTOMOUNT description for fstatat.2 as per the above, to indicate AT_NO_AUTOMOUNT should be avoided with fstatat() since it's ignored since 3.1 and implied since 4.11.

Quoted 7 lines

Don't mention commit v4.13-9318-g42f461482178 as it was reverted, and moot anyway since we can't adjust AT_NO_AUTOMOUNT since 3.1.

* man2/statx.2:
Mention that stat(), lstat(), and fstatat() imply AT_NO_AUTOMOUNT.

Makes sense to me.
But see a few minor comments below.

Thanks,

Alex

Quoted 52 lines
---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 31 deletions(-)
man2/stat.2 +3 -28
index 016c1f47d..9000b2ca6 100644
@@ -319,34 +319,9 @@ 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.
+.I pathname.
+Since Linux 3.1 this flag is ignored.
+Since Linux 4.11 this flag is implied.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
man2/statx.2 +0 -0
index 04b3e5075..d4e638756 100644

man2/statx.2 Don't automount the terminal ("basename") component of · line 199

Quoted 7 lines
man2/statx.2 +2 -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.

Weird break point there.
I see that it was like that in existing code, but please fix it :)

man2/statx.2 Don't automount the terminal ("basename") component of · line 207

Quoted 9 lines
man2/statx.2 +6 -1
+.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 () ,

s/() ,/(2),/

man2/statx.2 Don't automount the terminal ("basename") component of · line 208

Quoted 1 line
man2/statx.2 +1 -0
+.BR lstat () ,

s/() ,/(2),/

man2/statx.2 Don't automount the terminal ("basename") component of · line 210

Quoted 2 lines
man2/statx.2 +2 -0
+and
+.BR fstatat ()

s/()/(2)/

Quoted 10 lines
man2/statx.2 +4 -0
+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
Signature · 1 line
2.31.1
Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#14 lore raw

Hi Pádraig,

Quoted 2 lines · Alejandro Colomar (man-pages)
Quoted 1 line · Pádraig Brady

Subject: [PATCH] fix descriptions for AT_NO_AUTOMOUNT

Oh, and I forgot:
Please fix the subject according to the following guidelines:

<https://www.kernel.org/doc/man-pages/patches.html>

TL;DR:

foo.2, bar.3: Fix descriptions for AT_NO_AUTOMOUNT

Cheers,

Alex

Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#15 lore raw

PATCH 1/1 fix descriptions for AT_NO_AUTOMOUNT

In reply to Alejandro Colomar (man-pages)

fstatat(..., AT_NO_AUTOMOUNT) has had the following history in Linux:
v2.6.37-7314-g6f45b65672c8
add AT_NO_AUTOMOUNT and fstatat honors it
v3.1-rc7-68-gb6c8069d3577
ignore AT_NO_AUTOMOUNT since default operation now less eagerly mounts
v4.10-11255-ga528d35e8bfc
adds statx which reinstated 2.6.38 behavior for fstatat (not released)
v4.11-rc7-14-gdeccf497d804
adjust fstatat so that AT_NO_AUTOMOUNT always specified (to statx)

* man2/stat.2:
Adjust AT_NO_AUTOMOUNT description for fstatat.2 as per the above, to indicate AT_NO_AUTOMOUNT should be avoided with fstatat() since it's ignored since 3.1 and implied since 4.11.

Don't mention commit v4.13-9318-g42f461482178 as it was reverted, and moot anyway since we can't adjust AT_NO_AUTOMOUNT since 3.1.

* man2/statx.2:
Mention that stat(), lstat(), and fstatat() imply AT_NO_AUTOMOUNT.

---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 31 deletions(-)
man2/stat.2 +3 -28
index 016c1f47d..9000b2ca6 100644
@@ -319,34 +319,9 @@ 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.
+.I pathname.
+Since Linux 3.1 this flag is ignored.
+Since Linux 4.11 this flag is implied.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
man2/statx.2 +15 -3
index 04b3e5075..d4e638756 100644
@@ -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
Signature · 1 line
2.34.1
#16 lore raw

PATCH 1/1 stat.2, statx.2: Fix descriptions for AT_NO_AUTOMOUNT

In reply to Alejandro Colomar (man-pages)

fstatat(..., AT_NO_AUTOMOUNT) has had the following history in Linux:
v2.6.37-7314-g6f45b65672c8
add AT_NO_AUTOMOUNT and fstatat honors it
v3.1-rc7-68-gb6c8069d3577
ignore AT_NO_AUTOMOUNT since default operation now less eagerly mounts
v4.10-11255-ga528d35e8bfc
adds statx which reinstated 2.6.38 behavior for fstatat (not released)
v4.11-rc7-14-gdeccf497d804
adjust fstatat so that AT_NO_AUTOMOUNT always specified (to statx)

* man2/stat.2:
Adjust AT_NO_AUTOMOUNT description for fstatat.2 as per the above, to indicate AT_NO_AUTOMOUNT should be avoided with fstatat() since it's ignored since 3.1 and implied since 4.11.

Don't mention commit v4.13-9318-g42f461482178 as it was reverted, and moot anyway since we can't adjust AT_NO_AUTOMOUNT since 3.1.

* man2/statx.2:
Mention that stat(), lstat(), and fstatat() imply AT_NO_AUTOMOUNT.

---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 31 deletions(-)
man2/stat.2 +3 -28
index 016c1f47d..9000b2ca6 100644
@@ -319,34 +319,9 @@ 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.
+.I pathname.
+Since Linux 3.1 this flag is ignored.
+Since Linux 4.11 this flag is implied.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
man2/statx.2 +15 -3
index 04b3e5075..d4e638756 100644
@@ -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
Signature · 1 line
2.34.1
#17 lore raw
In reply to Alejandro Colomar (man-pages)

Hi Pádraig,

Quoted 4 lines · Alejandro Colomar (man-pages)

Please send the patch inline (or both inline and attached), if you don't mind.
However, if it's a big hassle for you,
I can apply it from an attachment.

Thanks for the inline patcx.

Quoted 5 lines

---

Quoted 3 lines

Subject: [PATCH] fix descriptions for AT_NO_AUTOMOUNT

[...]

Quoted 5 lines
Quoted 2 lines

Makes sense to me.
But see a few minor comments below.

But you missed the comments below :)
Please fix them (see below).

Thanks,

Alex

[...]

Quoted 7 lines
Quoted 7 lines
man2/statx.2 +0 -0
index 04b3e5075..d4e638756 100644
@@ -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
Quoted 8 lines

man2/statx.2 Don't automount the terminal ("basename") component of · line 199

Quoted 5 lines
man2/statx.2 +2 -2
 (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.

Weird break point there.
I see that it was like that in existing code, but please fix it :)

check

Quoted 12 lines

man2/statx.2 Don't automount the terminal ("basename") component of · line 207

Quoted 10 lines
man2/statx.2 +6 -1
+.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 () ,

s/() ,/(2),/

check

Quoted 4 lines

man2/statx.2 Don't automount the terminal ("basename") component of · line 208

Quoted 2 lines
man2/statx.2 +1 -0
+.BR lstat () ,

s/() ,/(2),/

check

Quoted 5 lines

man2/statx.2 Don't automount the terminal ("basename") component of · line 210

Quoted 3 lines
man2/statx.2 +2 -0
+and
+.BR fstatat ()

s/()/(2)/

check

Quoted 13 lines
Quoted 11 lines
man2/statx.2 +4 -0
+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
Signature · 1 line
2.31.1
Signature · 3 lines
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/
#18 lore raw

PATCH 1/1 stat.2, statx.2: Fix descriptions for AT_NO_AUTOMOUNT

fstatat(..., AT_NO_AUTOMOUNT) has had the following history in Linux:
v2.6.37-7314-g6f45b65672c8
add AT_NO_AUTOMOUNT and fstatat honors it
v3.1-rc7-68-gb6c8069d3577
ignore AT_NO_AUTOMOUNT since default operation now less eagerly mounts
v4.10-11255-ga528d35e8bfc
adds statx which reinstated 2.6.38 behavior for fstatat (not released)
v4.11-rc7-14-gdeccf497d804
adjust fstatat so that AT_NO_AUTOMOUNT always specified (to statx)

* man2/stat.2:
Adjust AT_NO_AUTOMOUNT description for fstatat.2 as per the above, to indicate AT_NO_AUTOMOUNT should be avoided with fstatat() since it's ignored since 3.1 and implied since 4.11.

Don't mention commit v4.13-9318-g42f461482178 as it was reverted, and moot anyway since we can't adjust AT_NO_AUTOMOUNT since 3.1.

* man2/statx.2:
Mention that stat(), lstat(), and fstatat() imply AT_NO_AUTOMOUNT.

---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 17 ++++++++++++++---
 2 files changed, 17 insertions(+), 31 deletions(-)
man2/stat.2 +3 -28
index 016c1f47d..9000b2ca6 100644
@@ -319,34 +319,9 @@ 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.
+.I pathname.
+Since Linux 3.1 this flag is ignored.
+Since Linux 4.11 this flag is implied.
 .TP
 .B AT_SYMLINK_NOFOLLOW
 If
man2/statx.2 +14 -3
index 04b3e5075..e579523af 100644
@@ -195,11 +195,22 @@ 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 (2),
+.BR lstat (2),
+and
+.BR fstatat (2)
+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
Signature · 1 line
2.34.1