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

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

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

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

root@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

Attachment: busybox-1.33.1-mount-explicit-rw-might-fail.patch
Description: Binary data

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to