All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Paul Eggert <eggert@cs.ucla.edu>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>
Cc: Gnulib bugs <bug-gnulib@gnu.org>, Coreutils <coreutils@gnu.org>,
	"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	Ian Kent <raven@themaw.net>, David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Colin Walters <walters@redhat.com>,
	Ondrej Holy <oholy@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Neil Brown <neilb@suse.com>
Subject: Re: [PATCH] fix descriptions for AT_NO_AUTOMOUNT
Date: Mon, 14 Mar 2022 18:02:56 +0000	[thread overview]
Message-ID: <4a4ad936-bb1c-328c-dd43-95f4abbb905c@draigBrady.com> (raw)
In-Reply-To: <dad1522f-21ee-620e-8fcf-b290bbb9aba5@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]

On 14/03/2022 13:24, Alejandro Colomar (man-pages) wrote:
> [Added a few CCs from the relevant kernel commits]
> 
> Hi Pádraig,
> 
> On 3/10/22 14:46, Pádraig Brady wrote:
>> 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
> 
> ---
> 
>> 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?

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.

>> 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.

>> 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

[-- Attachment #2: man-fix-AT_NO_AUTOMOUNT-2.diff --]
[-- Type: text/x-patch, Size: 3565 bytes --]

From f45367d494d9e97fa8a18d8e477e1facf259688c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
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.

Signed-off-by: Pádraig Brady <P@draigBrady.com>
---
 man2/stat.2  | 31 +++----------------------------
 man2/statx.2 | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 31 deletions(-)

diff --git a/man2/stat.2 b/man2/stat.2
index 016c1f47d..9000b2ca6 100644
--- a/man2/stat.2
+++ b/man2/stat.2
@@ -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
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


  reply	other threads:[~2022-03-14 18:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <ed3ac15c-9e92-73b7-b7f9-8281488e8778@draigBrady.com>
     [not found] ` <3a4c9f63-0203-a810-6113-5c77a16e3690@cs.ucla.edu>
     [not found]   ` <95140173-2913-e377-5824-8a569ac78b5b@draigBrady.com>
     [not found]     ` <5c608ef7-f279-6afc-37f5-6a50442a3143@cs.ucla.edu>
     [not found]       ` <bdd68a31-ef3a-f022-bc72-c051690cee59@draigBrady.com>
     [not found]         ` <6645f678-4293-4692-8472-eee0bacee63f@cs.ucla.edu>
     [not found]           ` <670898ee-3b1c-97cd-290c-b6d91bfdaa07@draigBrady.com>
     [not found]             ` <5612cf59-a6da-6974-6a97-e406a4f4d557@cs.ucla.edu>
     [not found]               ` <87bkyemetm.fsf@igel.home>
2022-03-10 13:46                 ` [PATCH] fix descriptions for AT_NO_AUTOMOUNT Pádraig Brady
2022-03-10 19:29                   ` Paul Eggert
2022-03-14 13:24                   ` Alejandro Colomar (man-pages)
2022-03-14 18:02                     ` Pádraig Brady [this message]
2022-03-14 19:56                       ` Alejandro Colomar (man-pages)
2022-03-14 20:00                         ` Alejandro Colomar (man-pages)
2022-03-14 21:03                         ` Pádraig Brady
2022-03-14 21:26                         ` [PATCH] stat.2, statx.2: Fix " Pádraig Brady
2022-03-14 22:16                         ` [PATCH] fix " Alejandro Colomar (man-pages)
2022-03-14 23:07                           ` [PATCH] stat.2, statx.2: Fix " Pádraig Brady

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4a4ad936-bb1c-328c-dd43-95f4abbb905c@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=akpm@linux-foundation.org \
    --cc=alx.manpages@gmail.com \
    --cc=bug-gnulib@gnu.org \
    --cc=coreutils@gnu.org \
    --cc=dhowells@redhat.com \
    --cc=eggert@cs.ucla.edu \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=neilb@suse.com \
    --cc=oholy@redhat.com \
    --cc=raven@themaw.net \
    --cc=schwab@linux-m68k.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=walters@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.