[BusyBox] Serious bug in find_mount_point.c

Rob Landley rob at landley.net
Fri Mar 11 16:23:01 UTC 2005


On Friday 11 March 2005 03:33 am, Brent Roman wrote:

> With this patch both 'df /' and 'df /dev/root' work properly.
> This is more than can be said for the "standard" linux df command.

I think the proper fix is to keep going until you find the _last_ mount point 
that matches, and then report that.  You can overmount and hide a previous 
mount point, you know.

root at ttyp2[~]# mkdir sub
root at ttyp2[~]# mount -t proc sub sub
root at ttyp2[~]# mount -t ramfs sub sub
root at ttyp2[~]# mount -t devpts sub sub
root at ttyp2[~]# cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root.old / ext2 rw 0 0
/proc /proc proc rw,nodiratime 0 0
/dev/pts /dev/pts devpts rw 0 0
/sys /sys sysfs rw 0 0
/dev/hda1 /cdrom ext2 ro 0 0
/dev/cloop /KNOPPIX iso9660 ro 0 0
/ramdisk /ramdisk tmpfs rw 0 0
/proc/bus/usb /proc/bus/usb usbdevfs rw 0 0
automount(pid1849) /mnt/auto autofs rw 0 0
/dev/hda2 /mnt/hda2 ext3 rw 0 0
/dev/hda3 /mnt/hda3 ext3 rw 0 0
sub /root/sub proc rw,nodiratime 0 0
sub /root/sub ramfs rw 0 0
sub /root/sub devpts rw 0 0
root at ttyp2[~]# umount sub
root at ttyp2[~]# umount sub
root at ttyp2[~]# umount sub
root at ttyp2[~]# umount sub
umount: sub: not mounted

I've got a pending mount rewrite that touches a lot of this stuff, I'll try to 
beat that into shape this weekend and get this fix in as well.  Thanks for 
pointing out the bug.

Rob



More information about the busybox mailing list