PATCH - mount bugfix - it behaves like util-linux mount

Roberto A. Foglietta roberto.foglietta at gmail.com
Tue Aug 10 16:29:31 UTC 2021


Hi all,

 this is following my message about "Curious bug in remounting read-only
cdrom mount point". I have created a patch to fix the behaviour of mount
aligning with uitl-linux mount.
 The main differences are the return codes and warning messages but AFAIK
they behave the same way in failures and success cases.

 I hope this patch will be applied and feel free to improve it.

 You can test with TinyCore Editor Suite v0.4.0 which has a fastlane to
test busybox changes

 busybox/busybox.sh update suid  (because mount belongs to suid exec in TC)

 For other changes use nosuid (or nothing which is the same).

 https://github.com/robang74/tinycore-editor/archive/refs/tags/v0.4.0.tar.gz


###### mount by util-linux ######

root at box:~# mount -o rw /dev/sr0 /mnt/sda2; echo $?
mount: /mnt/sda2: WARNING: source write-protected, mounted read-only.
0
root at box:~# grep /mnt/sda2 /proc/mounts
/dev/sr0 /mnt/sda2 iso9660
ro,relatime,nojoliet,check=s,map=n,blocksize=2048 0 0
root at box:~# umount /mnt/sda2

root at box:~# mount -w /dev/sr0 /mnt/sda2; echo $?
mount: /mnt/sda2: /dev/sr0 is write-protected but explicit read-write mode
requested.
32
root at box:~# grep /mnt/sda2 /proc/mounts

root at box:~# mount -o remount,rw /dev/sr0; echo $?
mount: /mnt/sr0: cannot remount /dev/sr0 read-write, is write-protected.
32

###### patched mount by busybox ######

root at box:~# /bin/mount -o rw /dev/sr0 /mnt/sda2; echo $?
0
root at box:~# grep /mnt/sda2 /proc/mounts
/dev/sr0 /mnt/sda2 iso9660
ro,relatime,nojoliet,check=s,map=n,blocksize=2048 0 0
root at box:~# umount /mnt/sda2

root at box:~# /bin/mount -w /dev/sr0 /mnt/sda2; echo $?
mount: mounting /dev/sr0 on /mnt/sda2 failed: Device or resource busy
255
root at box:~# grep /mnt/sda2 /proc/mounts

root at box:~# /bin/mount -o remount,rw /dev/sr0; echo $?
mount: mounting /dev/sr0 on /mnt/sr0 failed: Read-only file system
255

 Cheers,
-- 
Roberto A. Foglietta
+39.349.33.30.697
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210810/f97358ed/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-1.33.1-mount-explicit-rw-might-fail.patch
Type: application/octet-stream
Size: 1415 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20210810/f97358ed/attachment.obj>


More information about the busybox mailing list