Bug in mountpoint applet?
Michael Tokarev
mjt at tls.msk.ru
Wed Aug 15 06:12:59 UTC 2012
On 15.08.2012 05:58, Harald Becker wrote:
[]
> The util linux version has the device node compare as a fallback
> method. So why not have a global config option to enable the usage
> of /mnt/self/mountinfo ... for those who neglect to use such kind of
> interfaces.
As I mentioned already, this method is still unreliable. util-linux
mountpoint utility tries hard to find the thing, but it fails. For
example:
$ mkdir /tmp/test
$ cd /tmp/test
$ mkdir -p a/b
$ mount -t tmpfs tmpfsb a/b
# here, a/b is a mountpont obvously. Now, we mount another dir over everything:
$ mount -t tmpfs tmpfsa a
$ mkdir a/b
# here, a/b is a plain directory in upper tmpfsa which covers tmpfsb,
# it is NOT a mountpoint. Yet,
$ util-linux-mountpoint a/b
a/b is a mountpoint
But the traditional mountpoint utility (from sysvinit) correctly
says it is a mountpoint.
Note: there's no bind-mount tricks. It is just unreliable to parse
/proc/mounts (or mountinfo) -- exactly the thing I referred to
initially. It is not about funky names, it is only about a bit
more complex mount structure. It's too easy to trick it to believe
in different things. And once you add some mount --move or bind-
mounts into the mix, things becomes even more interesting.
It is a) unreliable (and hence buggy as I just demonstrated), b)
has a lot of code (busybox is about small size), relies on /proc
to be mounted (traditional mountpoint applet does not, and it is
perfectly okay for a chroot or another kind of system to work
without /proc). It is not a solution.
> Do we really need to have lengthy discussions about ugly things and
> unreliable interfaces when the question is something completely
> different? IMO no, so please let us concentrate about the main questions
> (report bind mount points and being compatible to util-linux). Thx.
My first reply to you was: "if you find a way to detect a mount point
WITHOUT RESORTING TO PARSING /PROC/MOUNTS, please tell us and save
the world." Until such a method is found, there's no point
discussing various buggy hacks. Sorry.
/mjt
More information about the busybox
mailing list