Repository navigation
v0.11.0 phase A: mv works, and the README says how far short of POSIX it falls - #239
Merged
Merged
Conversation
Rename is a server-side copy then a delete, per object; a directory moves
everything under its prefix. Before this, go-fuse's default for an absent
NodeRenamer answered every `mv` with ENOTSUP.
Six properties are load-bearing, and each was verified by mutation — the
implementation broken in that specific way, the test watched to fail:
- Each source object is deleted only after its own copy succeeds. An
interruption leaves the data at the old name, the new name, or both;
never at neither. Duplicated data is an operator's cleanup problem,
missing data is not recoverable, so the ordering is deliberate and a
partial directory move is resumable by re-running the same mv.
- The copy is server-side. Reading and rewriting through the process
would make renaming a 10 GiB file cost 20 GiB of transfer, and a
directory that times its object count. Above S3's 5 GiB single-part
CopyObject limit it routes through UploadPartCopy.
- The write path is flushed first. A copy acts on objects, so a file
whose only content is dirty ranges is invisible to it: `echo hi > a;
mv a b` would have copied a key that did not exist, deleted the
source, then flushed the pending ranges back to the old name — the
file landing at neither name the user asked for.
- The moved node is repointed, recursively for a directory. MvChild
re-parents the same inode, so a FileNode survives a rename holding
the path it was constructed with, and a stored path is stale the
moment a rename succeeds. After `mv a b`, a write to `b` flushed to
`a` and recreated the source the rename had just deleted. Silent at
every layer: a stale key is a valid key and every S3 call succeeds.
- Prefix matching is on a path boundary, so `mv dir dir-new` does not
move dir2/file. Not a hypothetical — the same defect keyMatches had.
- renameat2's RENAME_EXCHANGE and RENAME_NOREPLACE are refused with
EINVAL rather than approximated. Both are atomicity promises
copy-then-delete cannot keep, and mv and Git fall back correctly on
EINVAL. A foreign newParent is EXDEV, as go-fuse's own LoopbackNode
answers.
There is no atomic alternative to reach for: S3's RenameObject (2026) is
directory-bucket only, and object annotations are unsupported there, so
the two features are mutually exclusive. The README now carries a "Rename
is not atomic" section stating what a concurrent reader can observe and
which tools that breaks.
Also in this change, each found while building the above:
- chmod and tier transitions failed on every key containing a "+".
x-amz-copy-source is read as a URL path, url.PathEscape leaves "+"
alone, and S3 decodes "+" there as a space — so a self-copy of
"a+b.txt" asked for "a b.txt" and got 404 NoSuchKey. A "+" in a
filename is ordinary. Escaping now lives in one place; verified
against real S3 in us-west-2, where PathEscape and EscapedPath both
fail and %2B succeeds.
- GetStats reported zero for six live counters. Its copy named nine of
fifteen fields, dropping Creates, Deletes, Renames and the three
latency EMAs. Guarded now by a reflection test that sets each
counter to a distinct value, so a copy taking the right field from
the wrong source fails too.
- The README listed unlink and rmdir as EROFS and said mv fails
"because there is no rename". Both were true when written. A row
asserting an operation fails misleads in the worse direction once it
works: a reader avoids something that would have succeeded.
- internal/testaws grew a DirectoryMarkerDelete probe and a skip gate.
Deleting a `dir/` marker while `dir/child` exists panics the
emulator, whose object store is a filesystem abstraction where
`dir/` is the directory holding the child (scttfrdmn/substrate#534,
reproduced against afero alone). In S3 a key is an opaque string, so
this is the emulator's property, not ObjectFS's — hence a runtime
probe rather than asserting a dependency's bug as our contract.
- copy_live_test.go (-tags=integration) covers the multipart copy path
against real AWS at real part sizes. Substrate dispatches on
x-amz-copy-source before checking uploadId, so it answers an
UploadPartCopy as a whole-object copy with 200 (substrate#532),
leaving the branch where a mistake is most expensive — abandoned
parts are billed and invisible to ListObjects — resting on reading
alone.
Closes #164
FlushPrefix, DiscardPrefix, and underPrefix live in internal/vfs; their tests were in
internal/fuse/rename_test.go, which left all three reading 0.0% covered no matter how thoroughly
the rename tests exercised them. Coverage is per-package and the profile follows the code, not the
consequence — so the CI gate failed on internal/vfs at 95.4% against a floor of 98.
Moving them there bought two cases the fuse-level fixture could not reach:
- Failing a flush needs a backend that rejects a PUT. Asserting the rename must not proceed past
that is the whole point of stopping at the first failure, and it is the opposite of FlushAll's
press-on behavior, so it needs its own test rather than an assumption.
- Renaming a single file passes the file's own key where those methods take a prefix, so the
key-equals-prefix arm of underPrefix is the common path rather than an edge case. It was
invisible from a directory test because a key beneath a directory satisfies the boundary rule
too: "dir/a.txt" matches "dir" both ways. Mutation testing confirmed it — deleting that arm
left every directory rename correct, broke every file rename, and no test failed. Now
TestPrefixOperationsOnAnExactKeyTakeThatKey fails in both subtests.
internal/vfs is back to 98.4%.
Also count multipart-copy part numbers in the int32 that S3's PartNumber actually is, rather than
converting len(parts) on each iteration. The conversion could not overflow — S3 refuses the upload
above 10,000 parts — but a //nolint comment only quiets golangci-lint, and the gosec workflow
reported it as a new code-scanning alert. An argument a scanner cannot check is better replaced
than annotated.
Refs #164
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.
Closes #164.
Rename is a server-side copy then a delete, per object; a directory moves everything under its
prefix. Before this, go-fuse's default for an absent
NodeRenameranswered everymvwithENOTSUP.What is load-bearing
Six properties, each verified by mutation — the implementation broken in that specific way, the test
watched to fail. 11 mutants, 10 killed on the first pass; the 11th survived, was diagnosed as a
genuinely vacuous assertion, and the test was repaired until it discriminated.
UploadPartCopyecho hi > a; mv a bwould copy a key that does not exist, delete the source, then flush the pending ranges back to the old name — the file at neither name asked forMvChildre-parents the same inode, so a stored path is stale the moment a rename succeeds. Aftermv a b, a write tobflushed toaand recreated the source the rename had just deleted. Silent at every layer: a stale key is a valid key and every S3 call succeedsmv dir dir-newwould movedir2/file. Not hypothetical — the same defectkeyMatcheshadrenameat2flags are refused withEINVALRENAME_EXCHANGEandRENAME_NOREPLACEare atomicity promises copy-then-delete cannot keep.mvand Git fall back correctly onEINVAL. A foreignnewParentisEXDEV, as go-fuse's ownLoopbackNodeanswersThere is no atomic alternative to reach for. S3's
RenameObject(2026) is directory-bucket (Express)only, and object annotations — which ObjectFS needs for POSIX attributes — are unsupported on
directory buckets, so the two features are mutually exclusive. The README now carries a Rename is
not atomic section stating what a concurrent reader can observe, what an interruption leaves
behind, and which tools that breaks.
Also here, each found while building the above
chmodand automatic tier transitions failed on every key containing a+.x-amz-copy-sourceis read by S3 as a URL path;url.PathEscapeleaves+alone and S3 decodes+there as a space — so a self-copy ofa+b.txtasked fora b.txtand got404 NoSuchKey. A+in a filename is ordinary: version numbers, C++ sources,2026-08-01T00:00+00:00. Escaping nowlives in one place rather than open-coded at each call site, one of which escaped nothing at all.
Verified against real S3 in
us-west-2— bothPathEscapeandEscapedPath()fail,%2Bsucceeds, and every other character
PathEscapepasses through was probed on the same endpoint.objectfs statsreported zero for six counters that were maintained correctly all along.GetStatscopies field by field and its list named nine of fifteen:Creates,Deletes,Renames, and the three latency EMAs. Guarded now by a reflection test that sets each counter to adistinct non-zero value, so a copy taking the right field from the wrong source fails too.
time.Duration's reflect kind isInt64, which is how the three latency fields were found.unlinkandrmdirasEROFSand saidmvfails "because there is norename". Both true when written. A row asserting an operation fails misleads in the worse
direction once it works: a reader avoids something that would have succeeded. Rename's departure
from that table is pinned from the other side too — a test asserts the bridge dispatches to
Renamerather than reaching go-fuse'sENOTSUPdefault, which a drifted signature or anexcluding build tag would silently restore.
internal/testawsgrew aDirectoryMarkerDeleteprobe and a skip gate. Deleting adir/marker while
dir/childexists panics the emulator, whose object store is a filesystemabstraction where
dir/is the directory holding the child — filed asscttfrdmn/substrate#534, reproduced against
afero alone with no substrate involved. In S3 a key is an opaque string, so this is the emulator's
property and not ObjectFS's. Hence a runtime probe and a loud skip rather than asserting a
dependency's bug as this project's contract.
copy_live_test.go(-tags=integration) covers the multipart copy path against real AWS, atreal part sizes. Substrate dispatches on
x-amz-copy-sourcebefore checkinguploadId, so itanswers an
UploadPartCopyas a whole-object copy with 200 (substrate#532) — leaving the branchwhere a mistake is most expensive, since abandoned parts are billed and invisible to
ListObjects, resting on nothing but reading.Testing
15 tests in
internal/fuse/rename_test.go, against a real S3 endpoint throughinternal/testaws,with the real write path and real cache — no mock on any seam, which is the point: the v0.10.0 audit
found ~45 defects that 32,680 lines of tests had all missed, overwhelmingly because a mock on the far
side of a seam agrees with its caller by construction.