Repository navigation
fuse: implement renamex on macOS - #108
Open
rui-augusta wants to merge 1 commit into
Open
rui-augusta wants to merge 1 commit into
rui-augusta wants to merge 1 commit into
Conversation
The macFUSE FSKit backend routes renames through renamex, which was never filled in, so every rename failed with ENOSYS. An ordinary rename arrives with RENAME_EXCL and a rename over an existing name with RENAME_SWAP. The macOS flags map onto the ones Rename3 already defines: RENAME_EXCL to RENAME_NOREPLACE and RENAME_SWAP to RENAME_EXCHANGE. A file system that implements Rename only would otherwise remain broken for the ordinary case, so RENAME_EXCL is handled here by checking the destination first; RENAME_SWAP and RENAME_SECLUDE return ENOTSUP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #107.
struct fuse_operations.renamexwas never filled in, so on macOS with the FSKit backend every rename returned ENOSYS. The FSKit backend does not fall back to.rename.The macOS flags map onto the ones
Rename3already defines, so a file system written against cgofuse sees one flag vocabulary:RENAME_EXCLRENAME_NOREPLACERENAME_SWAPRENAME_EXCHANGERENAME_SECLUDEA file system that implements
Renameonly needs more than that, because an ordinary rename arrives withRENAME_EXCLrather than no flags at all, and the existinghostRenameanswers any non-zero flag with EINVAL. Such a file system would stay broken for the common case, soRENAME_EXCLis handled here: the destination is checked, EEXIST if it is taken, otherwise the plainRename.RENAME_SWAPis answered with ENOTSUP, which is whatrenamex_np(2)specifies for a flag the file system does not support; a file system that wants it can implementRename3.Tested on macOS 26.5.2 with macFUSE 5.3.3, Go 1.26, using the memfs example over
-o backend=fskit: rename of a file, rename of a directory, rename within a subdirectory, and a move across directories all work, where each previously failed with ENOSYS. Rename over an existing name returns ENOTSUP for memfs, as described above.go buildandgo vetpass on macOS and the cgo-less Windows build compiles; I have no Linux toolchain here, though the C change sits inside#if defined(__APPLE__)and the Go side is platform independent.I could not exercise the kext backend; it is not available on macOS 26.