Bug in mountpoint applet?

Harald Becker ralda at gmx.de
Tue Aug 14 20:05:51 UTC 2012


Hi Michael !

>Which GNU mountpoint utility (aka "upstream") you're talking about?
>On my (debian) system, /bin/mountpoint comes from sysvinit package,
>it is written by Miquel van Smoorenburg, and it has exactly the
>same problem with bind mounts.

Excuse me! I called it GNU utility, that's wrong. I thought it is a
GNU utility (core-util), but it is not. Have bean looking for the source
of my mountpoint and just found it in util-linux-2.21.2

It does definitely give correct result on bind mount points and does
this using /proc/self/mountinfo (just lurked into source).

>As for "reliability", /proc/self/mounts (or /proc/self/mountinfo which
>is exactly of the same nature in this context) may have complex
>structure describing complex structure of mounts on the sytem, when
>you can have nested cross-mounts - so the utility will have to build
>whole tree (or graph) of mounts to understand this structure.

To fully understand, may be ... just to check if you hit a mount point
-> NO ! ... but more see source from util-linux package. Have not
looked on the details.

>again due to this same bind mounts, or (sym)links, or due to mount
>--move or something else, the path given to `mountpoint' utility might
>be not the same path recorded in /proc/mounts (or mountinfo - again,
>does not matter), it might be some alternative path leading to the
>same directory. So our great mountpoint utility will need to very
>carefully canonicalize the given argument first, before looking it up
>in mounts (or mountinfo), and there is no single way to canonicalize a
>given path generally.  So parsing mounts (or mountinfo) is inherently
>unreliable, even after somehow overcoming the problem with special
>characters in pathnames.  We should have some much more reliable
>interface here, and kernel does not provide it.  So any utility which
>tries to detect such bind mounts is broken in one or another way.

You may be right ... but I do not want to make things more complicated
then the utility from util-linux does. I'm only requesting to let
Busybox give the same results ... which may indeed be wrong for ugly
names (shoot admins doing this) or complex cross links. But better
to have it in same way then missing even simple bind mount cases.

--
Harald


More information about the busybox mailing list