Bug 11461 - mount(8) passes arguments to mount helpers in wrong order
Summary: mount(8) passes arguments to mount helpers in wrong order
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.29.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-01 02:36 UTC by opal hart
Modified: 2018-11-03 20:22 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description opal hart 2018-11-01 02:36:14 UTC
Originally reported from https://bugs.alpinelinux.org/issues/9609 – I took the initiative here because I have also experienced this issue with my exfat mounts.

In summary:

> root is not able to mount exFAT partitions with /bin/mount
> 
> This has to do with how busybox mount(1) orders arguments when sending to the mount helper.
> 
> Dummy helper script:
> % cat `which mount.test`
> #!/bin/sh
> echo "$@"
> 
> Example fstab entry:
> mount.test#/var/empty /tmp/foo fuse user 0 0
> 
> Example invocation:
> % mount /tmp/foo
> /var/empty /tmp/foo -o rw,noexec,nosuid,nodev
> 
> Notice how the options '-o ...' are appended to the command. mount.exfat(1) expects options and other flags to preceed the target directory:
> % sudo mount.exfat /dev/sdd /media/usb -o rw
> FUSE exfat 1.3.0
> Usage: mount.exfat [-d] [-o options] [-V] <device> <dir>
Comment 1 Denys Vlasenko 2018-11-03 17:38:12 UTC
(In reply to opal hart from comment #0)

#!/bin/sh
echo "ARGS:$@"

| Example fstab entry:
| mount.test#/var/empty /tmp/foo fuse user 0 0
| 
| Example invocation:
| % mount /tmp/foo
| /var/empty /tmp/foo -o rw,noexec,nosuid,nodev

I don't get that, I get:

# ./busybox mount /tmp/foo
ARGS:/var/empty /tmp/foo
Comment 2 opal hart 2018-11-03 20:22:26 UTC
(In reply to Denys Vlasenko from comment #1)

Change fstab entry to include options then. For instance,
sed -i 's/user/&,nosuid,nodev/' /etc/fstab

On my system (Alpine edge) it automatically includes a few options for most mounts.