tuxera / ntfs-3g

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

Minor autoconf improvements for portability #39

Closed delroth closed 2 years ago

delroth commented 2 years ago

These two commits improve the portability of ntfs-3g on systems that do not use the standard Linux FHS (e.g. NixOS, Gobo, GuixSD, etc.).

unsound commented 2 years ago

The first one is a duplicate of: https://github.com/tuxera/ntfs-3g/issues/21

delroth commented 2 years ago

The first one is a duplicate of: https://github.com/tuxera/ntfs-3g/issues/21

Interesting, thanks. I'm a bit confused because there's already a "rootsbindir" variable defined and used in ntfs-3g which is exactly supposed to represent where to put the mount helpers. It's already being used in some places in the same files, just not everywhere. Fixing this seemed non-controversial to me in that regard...

delroth commented 2 years ago

One thing I noted while reading through #21: mount. don't necessarily have to be installed in /sbin. util-linux can be configured with any arbitrary list of paths in --enable-fs-paths-default where it will look for mount., among other things. You are absolutely correct that /sbin is by far the most common place, but I don't think providing a lever for users to override this would hurt or hinder usability? (especially since ~all the scaffolding is in place for it already in ntfs-3g, with a different sbindir and rootsbindir already being partially supported!)

delroth commented 2 years ago

As another data point, here's a list of distributors I've found that currently carry custom patches and/or sed-hacks relevant to that first commit:

https://github.com/archlinux/svntogit-packages/blob/packages/ntfs-3g/trunk/PKGBUILD#L24 https://src.fedoraproject.org/rpms/ntfs-3g/blob/rawhide/f/ntfs-3g.spec#_127 https://github.com/gobolinux/Recipes/blob/master/NTFS-3G/1.0/02-prefix.patch https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/filesystems/ntfs-3g/default.nix#L22 https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/linux.scm#n6135

unsound commented 2 years ago

The first one is a duplicate of: #21

Interesting, thanks. I'm a bit confused because there's already a "rootsbindir" variable defined and used in ntfs-3g which is exactly supposed to represent where to put the mount helpers. It's already being used in some places in the same files, just not everywhere. Fixing this seemed non-controversial to me in that regard... Maybe @unsound can weigh in now that clearly several people have run into this issue and there's a working patch ready to be merged :-)

I commented on this here: https://github.com/tuxera/ntfs-3g/issues/21#issuecomment-1017514303

The main point is we cannot use what's supplied through--sbindir (which is what rootsbindir gets set to) because that's the install location where the installed executables are supposed to go. It's configurable and has no relation to where the system requires the symlink to be. E.g. by default you'd install a user-built ntfs-3g in /usr/local to avoid conflicts with system-supplied software in /usr and then you'd have a mount helper in /usr/local/sbin which is unlikely to work unless you've specifically built mount to look there (for security reasons this doesn't sound like the best idea). You may even want to use /home/<user> as the prefix. None of these match the default location specified in the manpage ( https://github.com/util-linux/util-linux/blob/master/sys-utils/mount.8.adoc ). The manpage documents /sbin as the only location for mount helpers, even though in reality it seems that it's not that simple. (An update to the aforementioned util-linux manpage might be in order.)

We'd need a new configure option to select mount helper install directory, but really I would argue that with such a custom setup you can just pass --disable-mount-helper and create the symlinks with three simple terminal commands. On the other hand if this is really such a huge hassle for people integrating the software then I could propose the attached patch: 0001-Add-with-mount-helper-dir-configure-option.patch.zip

delroth commented 2 years ago

Closing this PR, it feels like we're just talking past each other anyway and I don't feel like continuing will be particularly productive. Feel free to cherry pick the 2nd commit we haven't really discussed here if you feel like it's desirable.