99.1. fuse-3.18.3
The Filesystem in Userspace library (libfuse 3) and the setuid fusermount3 mount helper
| Version | 3.18.3, release 1 |
| Shelf | filesystem — Filesystem utilities, FUSE, and network or encrypted filesystems |
| Phase | 41_system (System), 78 of 1047 in build order |
| Licence | LGPL-2.1-only AND GPL-2.0-only |
| Homepage | https://github.com/libfuse/libfuse |
| Build time | 0.1 SBU |
| Installed size | 639.3 KiB in 19 files |
| Recipe | ports/core/filesystem/fuse/kpkgbuild |
About
FUSE lets an ordinary program serve a filesystem: the kernel passes each file operation on a FUSE mount to the process behind it, through /dev/fuse. This port is libfuse 3, the library such a program is written against, and fusermount3, the setuid helper that performs the mount and unmount for a user who may not call mount(2) themselves. sshfs, gocryptfs, fuse-overlayfs, gvfs, the document portal, rclone mount and restic mount all go through it; see setuid binaries.
Sources
fuse-3.18.3.tar.gz(2.5 MiB)
sha256bcd19582c5e30f7fe45dd86a5540e998590aa01903afc7ebcbeea6c8ac5421ee
upstream: https://github.com/libfuse/libfuse/releases/download/fuse-3.18.3/fuse-3.18.3.tar.gz
archive copy: sources-2/filesystem--fuse-3.18.3.tar.gz
Dependencies
Depends on: meson, ninja, eudev, liburing, numactl.
Required by (24): afflib, android-file-transfer, deja-dup, e2fsprogs, freerdp, fuse-overlayfs, gocryptfs, gvfs, ifuse, kio-fuse, libewf, libnbd, libvhdi, libvmdk, libvslvm, partclone, plasma-vault, qemu, rclone, restic, sshfs, veracrypt, wimlib, xdg-desktop-portal.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install fuse'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/filesystem/fuse.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/filesystem/fuse
echo 'bcd19582c5e30f7fe45dd86a5540e998590aa01903afc7ebcbeea6c8ac5421ee fuse-3.18.3.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/fuse
SRC=$SRC_ROOT/fuse-3.18.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf fuse-3.18.3.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
meson setup build --buildtype=release \
--prefix=/usr --sysconfdir=/etc --libdir=lib --libexecdir=/usr/lib \
-Dinitscriptdir= \
-Dudevrulesdir=/lib/udev/rules.d \
-Denable-io-uring=true \
-Dexamples=false \
-Dtests=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
readelf -d "$PKG"/usr/lib/libfuse3.so.*.*.* | grep -q 'NEEDED.*\[liburing\.so'
rm -rf "$PKG/dev"
ln -s fusermount3 "$PKG/usr/bin/fusermount"
The switches, and why each is set:
--libexecdir=/usr/lib— Where internal helper programs would go. libfuse 3 installs none, so the switch changes nothing in the package.-Dinitscriptdir=— Empty: install no SysV init script. Upstream’s default writes/etc/init.d/fuse3, which loads thefusemodule and mounts thefusectlcontrol filesystem. KDOS’srcSruns only scripts namedNN_name.shin that directory, so the file would sit there and never run.-Dudevrulesdir=/lib/udev/rules.d— Install99-fuse3.rules, which gives/dev/fusemode 0666, into this directory. Left empty, meson asks pkg-config for udev’s directory instead.-Denable-io-uring=true— Build the FUSE-over-io-uring transport, in which requests and replies pass through io_uring queues instead ofreadandwriteon/dev/fuse. On is upstream’s default; see Notes for what it actually requires.-Dexamples=false— Build none of the example filesystems.-Dtests=false— Compile no test programs.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/fuse, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf fuse-3.18.3-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/fuse, and runs the triggers its paths call for.
Contents
Installed programs: fusermount, fusermount3, mount.fuse3.
Installed libraries: libfuse3.so.
Installed directories: /usr/include/fuse3, /usr/share/licenses/fuse.
Short descriptions
fusermount3 |
mount and unmount FUSE filesystems |
mount.fuse3 |
configuration and mount options for FUSE file systems |
fuse3.pc |
Filesystem in Userspace |
Notes
The io_uring transport is built only when meson finds both liburing and libnuma (from numactl) and a test program using IORING_SETUP_SQE128 links. When any of those fails, configure turns the transport off without an error, whatever -Denable-io-uring says. numactl is in depends for that libnuma, and the readelf -d … | grep -q 'NEEDED.*\[liburing\.so' line after the install stops the build when libfuse3.so does not link liburing, instead of shipping a library without the transport.
The install script, with upstream’s default useroot, makes fusermount3 owned by root and setuid, and creates a /dev/fuse device node under $PKG. build.sh removes $PKG/dev: the running system’s /dev is a devtmpfs the kernel fills, and the udev rule gives the node its mode. The setuid bit stays.
fusermount is a symbolic link to fusermount3, because some FUSE clients (restic’s among them) run the unversioned name.