Bug in mountpoint applet?

Harald Becker ralda at gmx.de
Tue Aug 14 13:08:28 UTC 2012


Hi Michael !

>If you can detect such a mountpoint somehow, without resorting to
>parsing /proc/mounts, please let the world know.

The GNU mountpoint utility shows correct info about mountpoints, so at
least there you can find the info of how it is done!

And this seams to work too ...

my_mpoint () {
  busybox grep -q " $( busybox realpath "$1" ) r[ow]" /proc/self/mountinfo \
    && echo "$1 is mountpoint" \
    || echo "$1 is not mountpoint"
}

my_mpoint m
m is not mountpoint
my_mpoint r
r is mountpoint

> So there's no known way to detect such mountpoints

What about GNU mountpoint utility? It does the job!

> , and parsing /proc/mounts is at least slow and unreliable.

Don't talking about speed ... sure, /proc/mounts is
unreliable ... but /proc/self/mountinfo seams to be reliable.

... and: If i need to call a defined function using grep to find out if
it is a mountpoint, an applet reading and looking for an entry in
/proc/self/mountinfo won't be slower, will it?

>This is a kernel interface problem, and is known since the day
>bind mounts were introduced in 2.4 kernel.

At least newer kernel have /proc/self/mountinfo ... and does speed
matter more than correctness? What about upstream compatibility?

--
Harald


More information about the busybox mailing list