On Tue, Aug 10, 2021 at 6:30 PM Roberto A. Foglietta
<[email protected]> wrote:
>
> 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
So, unit-linux _does_ fall back to RO if -o rw is specified?
Then this is wrong:
+ if(!explicit_rw) {
+ if (!strncasecmp("rw", newopts, 2)) {
+ explicit_rw = 1;
+ }
+ }
(as well as buggy, it would think that "-o rwqwerty" is "rw").
+static bool explicit_rw = 0;
...
+ if (opt & OPT_w) {
+ explicit_rw = 1;
+ append_mount_options(&cmdopts, "rw"); // -w
+ }
Global variable option_mask32 already exists, and already has
the flag bit set for you. Let's just use it.
Fixed in git. Thank you for the bug report.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox