Re: For review: rewritten pivot_root(2) manual page
From: G. Branden Robinson
Date: Wed Oct 09 2019 - 04:18:43 EST
At 2019-10-09T09:41:34+0200, Michael Kerrisk (man-pages) wrote:
> I'm not sure. Some people have a bit of trouble to wrap their head
> around the pivot_root(".", ".") idea. (I possibly am one of them.)
> I'd be quite keen to hear other opinions on this. Unfortunately,
> few people have commented on this manual page rewrite.
pivot_root(".", ".") seems as ineffable to me as chdir(".").
Meaning mostly, but not completely.
I have an external drive with a USB cable that's a little dodgy. If it
moves around a bit the external drive gets auto-unmounted, and then
remounted in the same place, so I can experience the otherwise-baffling
shell experience of:
[disconnect/reconnect happens; the device is mounted again now]
$ ls .
Input/output error
$ cd .
$ ls .
[perfectly fine listing]
What's happened is that the meaning of "." has subtly changed in a way
that I suppose would never have been seen back in Version 7 Unix days.
Maybe I've been reading too much historical documentation (I'm currently
enjoying McKusick et al.'s _Design and Implementation of the 4.4BSD
Operations System_), but the way we describe and teach Unixlike systems
in operating systems classes and, more to the point, in our man pages I
think continues to be strongly informed by the invariants we learned in
our youth, and which are slowly but steadily being invalidated.
Concretely, I recommend having pivot_root(".", ".") in the man page as
an example, but perhaps as an alternate. Because it is
counterintuitive (to some minds), it's worth spending some time to
explain it. But I would offer it because it's a valid use of the system
call and because it makes sense to a domain expert (Eric Biedermann).
I would try to offer an explanation myself but I lack the understanding.
_If_ I'm following the discussion correctly, which I doubt, then what I
imagine to happen is that a sequence point occurs between the function
parameters, and "." changes its meaning as with my "cd ." example above.
I am probably reasoning by analogy, and perhaps not by a good one.
Also, it is okay if the language of this page continues to evolve over
time. I appreciate your desire to get it "perfect" (or at least to some
local optimum) now since you're most of the way through an overhaul of
it, but it is not just the system that changes with time--the audience
does too.
Maybe in 5 or 10 years, the kids will be au fait with pivot_root(".",
".") and only some graybeards will continue to think of it as a bit
strange.
Regards,
Branden
Attachment:
signature.asc
Description: PGP signature