Skip to content

Preserve destinations when receiving a symlink fails - #10954

Merged
kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
hezhizhen:codex/fix-transfer-symlink-replacement
Nov 27, 2026
Merged

kovidgoyal merged 1 commit into
kovidgoyal:masterfrom
hezhizhen:codex/fix-transfer-symlink-replacement

Conversation

@hezhizhen

Copy link
Copy Markdown
Contributor

Summary

Preserve an existing destination when the transfer kitten cannot create a received symbolic link. Use the existing atomic symlink helper to create the replacement before renaming it into place.

Use a short temporary basename in the destination directory so valid names at the filesystem limit remain replaceable. An incoming link that conflicts with an existing directory now leaves that directory in place.

Evidence

  • On macOS arm64, the new failure test reports an error and finds the original destination missing on the upstream baseline. With this change, the original contents are preserved.
  • The 255-byte destination name test passes with the short temporary name and fails with the previous name scheme.
  • The transfer package passed all 21 tests. Both receive integration tests passed with a fresh development build.
  • The tools/utils and kittens/ssh tests passed with their login-shell and shared-memory cases rerun outside the sandbox.
  • go vet -tags testing ./kittens/transfer ./tools/utils, gofmt -s, and git diff --check passed.

Use the atomic symlink helper for incoming transfer links so a failed
replacement preserves the existing destination.

Use a short temporary basename so replacing a destination with a
maximum-length name also works.
@kovidgoyal
kovidgoyal merged commit 237902e into kovidgoyal:master Nov 27, 2026
14 checks passed
@hezhizhen
hezhizhen deleted the codex/fix-transfer-symlink-replacement branch November 27, 2026 15:03
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.

2 participants