Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuse reported filesystem type is fuseblk, it should be fuse.ntfs #36

Open
meven opened this issue May 1, 2022 · 16 comments
Open

Fuse reported filesystem type is fuseblk, it should be fuse.ntfs #36

meven opened this issue May 1, 2022 · 16 comments

Comments

@meven
Copy link

meven commented May 1, 2022

cat /proc/mounts with fuse mounted ntfs will report the fs type of the block is fuseblk.
This makes it hard to distinguish the fuse mounts from other kinds (fuse.nfs ...).

This causes issues downstream like https://bugs.kde.org/show_bug.cgi?id=451408

Please consider make the fuse ntfs driver report a more descriptive filesystem type, like fuse.ntfs or fuseblk.ntfs

https://github.com/tuxera/ntfs-3g/search?q=fuseblk

@jpandre
Copy link
Collaborator

jpandre commented May 1, 2022

This is a fuse issue, AFAIK ntfs-3g cannot do anything about it, unless fuse implements some interface for it. You should probably report to https://github.com/libfuse/libfuse/issues

@jpandre jpandre closed this as completed May 1, 2022
@meven
Copy link
Author

meven commented May 2, 2022

The issue seems to be that fsname option is not to fuse_mnt_add_mount but whatever mounts ntfs drive, I am not sure what daemon or system handles this, probably udisk2.
In some cases, it works like the xdg-portal case.

@Vogtinator
Copy link

Vogtinator commented May 4, 2022

This is a fuse issue, AFAIK ntfs-3g cannot do anything about it, unless fuse implements some interface for it.

The libfuse interface for that is fuse_parse_cmdline, which sets the subtype= option (fsname on FreeBSD) to the basename of the program by default. If you can't use fuse_parse_cmdline, you can just hardcode subtype=ntfs-3g as mount option.

@jpandre
Copy link
Collaborator

jpandre commented May 4, 2022

you can just hardcode subtype=ntfs-3g as mount option.

Interesting, thanks. Just checked with libfuse3 and this works, but ntfs-3g usually uses fuse-lite which does not support this option.

Anyway, I am having this set up for a later version.

@Vogtinator
Copy link

you can just hardcode subtype=ntfs-3g as mount option.

Interesting, thanks. Just checked with libfuse3 and this works, but ntfs-3g usually uses fuse-lite which does not support this option.

Apparently it was explicitly removed: f56ee25

Anyway, I am having this set up for a later version.

@unsound
Copy link
Member

unsound commented May 5, 2022

One concern: If we set the subtype option by default it might break existing scripts and setups which match mounts by the fstype 'fuse' or 'fuseblk' exactly (not by prefix). If we do consider making it a default option, not set by the mounter then we should also need to make sure that it can be disabled (having a nosubtype option maybe?).

@Vogtinator
Copy link

One concern: If we set the subtype option by default it might break existing scripts and setups which match mounts by the fstype 'fuse' or 'fuseblk' exactly (not by prefix).

That would be broken anyway. If the goal is to get ntfs3g mounts, it would also match non-ntfs3g fuse(blk) mounts. If the goal is to match all fuse(blk) mounts, then it would miss the majority of them.

@jpandre jpandre reopened this May 5, 2022
@jpandre
Copy link
Collaborator

jpandre commented May 5, 2022

I am reopening the issue as more examination is needed.

For instance, what about an external disk plugged in and mounted automatically ?

@unsound
Copy link
Member

unsound commented May 5, 2022

@Vogtinator:

One concern: If we set the subtype option by default it might break existing scripts and setups which match mounts by the fstype 'fuse' or 'fuseblk' exactly (not by prefix).

That would be broken anyway. If the goal is to get ntfs3g mounts, it would also match non-ntfs3g fuse(blk) mounts. If the goal is to match all fuse(blk) mounts, then it would miss the majority of them.

Broken or not, such scripts may exist so it makes sense to have the option to revert the change in behaviour.

@ahmadsamir
Copy link

ahmadsamir commented Sep 8, 2022

For an NTFS partition, mounted as fuseblk (as reported by stat / statfs / /proc/ self/mountinfo), if that partition is on a local disk, then can we assume that it'll use the sd driver, and will have a device node /dev/sdXY?

If so, then we can test for that, and it would at least partially solve the issue in KDE's KIO.

@sedimentation-fault
Copy link

As someone who has just finished writing a script that needed the type of a mounted NTFS partition, I can tell you that this situation is unbearable. Please correct it. I am sure you can. And I don't care if I would have to "correct" my own script, since the correction would remove the extra case I had to program for NTFS. Because instead of the simple (and fast!)

partition_fs_type="$(cat /proc/mounts | grep "$part" | awk -e '{print $3}')"

I now have to take the route through blkid -o full mounted-partition as in

mounted_dev="$(mount | grep "$part" | awk -e '{print $1}')"
partition_fs_type="$(blkid -o full "$mounted_dev" | sed -e 's/.* TYPE="\([^"]*\)".*/\1/')"

(Here part is the partition name, e.g. sdk1, while mounted_dev might be something like /dev/mapper/XXX)

BTW the blkid method is the only way I have found that will compute 'ntfs' as the filesystem type of a given NTFS-formatted partition.

See also the long, painful discussion for this should-be-painless issue at

NTFS partition reported as fuseblk

@ahmadsamir
Copy link

@sedimentation-fault
Copy link

@ahmadsamir
In that commit it says

// Code originally copied from util-linux/misc-utils/lsblk.c

So you use code from lsblk. I use blkid to determine filesystem type (including 'ntfs') in the code I posted above. Both utilities are part of the same package: util-linux. So we are talking about the same method, you in the code, me on the command line. :-)

@ahmadsamir
Copy link

@ahmadsamir In that commit it says

// Code originally copied from util-linux/misc-utils/lsblk.c

So you use code from lsblk. I use blkid to determine filesystem type (including 'ntfs') in the code I posted above. Both utilities are part of the same package: util-linux. So we are talking about the same method, you in the code, me on the command line. :-)

Yep, I mainly posted that link for those who need a C++ solution of this issue :)

@unsound
Copy link
Member

unsound commented Dec 19, 2022

Posting a proposed patch for this issue, appending the subtype 'ntfs-3g' by default. Feedback appreciated.
0001-Append-subtype-option-to-ntfs-3g-default-options-on-.patch

@meven
Copy link
Author

meven commented Dec 19, 2022

Posting a proposed patch for this issue, appending the subtype 'ntfs-3g' by default. Feedback appreciated. 0001-Append-subtype-option-to-ntfs-3g-default-options-on-.patch

Make it a PR ;), it is way easier to discuss that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants