Bug 11461

Summary: mount(8) passes arguments to mount helpers in wrong order
Product: Busybox Reporter: opal hart <opal>
Component: Standard ComplianceAssignee: unassigned
Status: NEW ---    
Severity: normal CC: busybox-cvs, waynedpj
Priority: P5    
Version: 1.29.x   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:

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.