tuxera / ntfs-3g

NTFS-3G Safe Read/Write NTFS Driver
https://www.tuxera.com/company/open-source
GNU General Public License v2.0
999 stars 149 forks source link

ntfs-3g gives exit code 0 even when failing to mount on FreeBSD #89

Closed lytithwyn closed 1 year ago

lytithwyn commented 1 year ago

On FreeBSD 13.2 Release with fusefs-ntfs installed from the packages repository (which reports version 2022.10.3) if I try to mount an ntfs partition/slice without proper privileges, I expect ntfs-3g to fail and give a non-zero exit code per the man page. This is the behavior I see on Linux.

On FreeBSD, however, I do get an error output to the console, but the exit code is 0. Here is an example of the command line and the output that I see:

[lytithwyn@beastie ~]$ ntfs-3g /dev/ada2s1 /tmp/msmount/lytithwyn/ada2s1/
Error opening '/dev/ada2s1' read-write
Could not mount read-write, trying read-only
mount_fusefs: /dev/fuse on /tmp/msmount/lytithwyn/ada2s1: Operation not permitted
[lytithwyn@beastie ~]$ echo $?
0
[lytithwyn@beastie ~]$ 
unsound commented 1 year ago

In general you could first file a bug against the maintainer of the FreeBSD package as it has FreeBSD specific patches and may not match our upstream state. However I was curious and did a little testing. It appears as though this message is emitted inside fuse_loop and doesn't even cause fuse_loop to return an error. So I'm not sure how we could do this differently given the behaviour of libfuse on FreeBSD. If it had returned an error code we could pass it on, but given what we have to work with there's not much we can do to detect such privilege issues. This would affect all users of libfuse as far as I can tell and is not really an ntfs-3g bug.

lytithwyn commented 1 year ago

Ah, I see. Thank you very much for looking into that for me! I think in this case I'm going to just look for the error on stderr and go based on that instead of the return code.