Skip to content

Support FreeBSD - #387

Merged
folbricht merged 1 commit into
masterfrom
upgrade-go-fuse
Aug 29, 2026
Merged

folbricht merged 1 commit into
masterfrom
upgrade-go-fuse

Conversation

@folbricht

Copy link
Copy Markdown
Owner

go-fuse v2.2.0 only builds on Linux and macOS, so the FreeBSD build was broken despite the README listing BSD as "Untested — expected to work". This upgrades it to v2.11.0, which supports FreeBSD. No source changes were needed for the upgrade itself — the fs and fuse APIs desync uses are unchanged across those versions.

That uncovered a second problem: createDeviceNode for non-Linux passed the device number to unix.Mknod as an int, but FreeBSD takes a uint64. FreeBSD has mknodat(2), so rather than widening the fallback, it gets its own implementation using the same Root-relative creation as Linux — which also confines it better than the darwin path that resolves the parent through os.Root and then creates on the real path.

FreeBSD is now built by goreleaser (amd64 and arm64) and validated in CI two ways: a cross-compile in the main matrix for a fast signal, and the full test suite in a FreeBSD VM, since GitHub has no FreeBSD runner.

NetBSD, OpenBSD and DragonFly still don't build — go-fuse has no support for them — so the README now says that explicitly instead of lumping all BSDs together as untested.

Verified locally: GOOS=freebsd builds and vets clean for amd64/arm64; darwin, windows and linux/arm64 still build; go test ./... and go test -race ./... pass on Linux, including TestMountIndex, which does a real FUSE mount against the new go-fuse.

The FreeBSD test job has not run anywhere before this PR, so its first run here is the real verification.

go-fuse v2.2.0 only builds on Linux and macOS, so the FreeBSD build was
broken despite the README listing BSD as expected to work. Upgrade it to
v2.11.0, which supports FreeBSD. No source changes were needed for the
upgrade itself, the fs and fuse APIs desync uses are unchanged.

That uncovered a second problem: createDeviceNode for non-Linux passed
the device number to unix.Mknod as an int, but FreeBSD takes a uint64.
FreeBSD has mknodat(2), so rather than widening the fallback, give it its
own implementation using the same Root-relative creation as Linux, which
also confines it better than the darwin path that resolves the parent and
then creates on the real path.

FreeBSD is now built by goreleaser and validated in CI: a cross-compile
in the main matrix for a fast signal, and the full test suite in a
FreeBSD VM. NetBSD, OpenBSD and DragonFly remain unsupported since
go-fuse does not build there, so the README now says so instead of
lumping all BSDs together as untested.
@folbricht
folbricht merged commit 9aafd9b into master Aug 29, 2026
4 checks passed
@folbricht
folbricht deleted the upgrade-go-fuse branch August 29, 2026 11:32
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

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址