public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Lennart Poettering <lennart@poettering.net>
To: NeilBrown <neilb@suse.com>
Cc: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
	linux-man@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH man-pages] open.2: improve O_PATH documentation.
Date: Thu, 10 Aug 2017 12:21:04 +0200	[thread overview]
Message-ID: <20170810102104.GA16888@gardel-login> (raw)
In-Reply-To: <873790rtni.fsf@notabene.neil.brown.name>

On Do, 10.08.17 13:25, NeilBrown (neilb@suse.com) wrote:

> +If
> +.I pathname
> +refers to an automount point that has not yet been triggered, so no
> +other filesystem is mounted on it, then the call returns a file
> +descriptor referring to the automount directory without triggering a mount.
> +.BR fstatfs (2)
> +can then be used to determine if it is, in fact, an untriggered
> +automount point
> +.RB ( ".f_type == AUTOFS_SUPER_MAGIC" ).

Because Linux is broken you shouldn't compare f_type just like this,
and the man page probably shouldn't suggest that either I figure. The
only safe way is something like this:

     s.f_type == (typeof(s.f_type)) AUTOFS_SUPER_MAGIC

That's because f_type is defined with different types (both signed and
unsigned) on different archs, and the magic values tend to use the
full unsigned 32bit range...

(Yes, strictly speaking AUTOFS_SUPER_MAGIC isn't one of the unsigned
32bit ones, but I think it's better to stick the same rules for all
magic values comparisons here...)

(And yes, the statfs() man page only mentions the problem briefly,
without the typeof way out, but it really should)

Lennart

-- 
Lennart Poettering, Red Hat

  reply	other threads:[~2017-08-10 10:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10  3:25 [PATCH man-pages] open.2: improve O_PATH documentation NeilBrown
2017-08-10 10:21 ` Lennart Poettering [this message]
2017-08-10 14:02   ` Krzysztof Błaszkowski
2017-08-10 23:04     ` NeilBrown
2017-08-12 20:13       ` Michael Kerrisk (man-pages)
2017-08-10 15:50   ` Matthew Wilcox
     [not found] ` <873790rtni.fsf-wvvUuzkyo1HefUI2i7LXDhCRmIWqnp/j@public.gmane.org>
2017-08-12 20:11   ` Michael Kerrisk (man-pages)

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=20170810102104.GA16888@gardel-login \
    --to=lennart@poettering.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    --cc=neilb@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox