fix: handle long hardlink and symlink targets in save archive#134
Merged
mobileoverlord merged 1 commit intomainfrom May 1, 2026
Merged
fix: handle long hardlink and symlink targets in save archive#134mobileoverlord merged 1 commit intomainfrom
mobileoverlord merged 1 commit intomainfrom
Conversation
The previous code called Header::set_link_name directly on a cloned header, which silently truncates targets longer than 100 bytes. Combined with the avocado-state/volume/ prefix added to hardlink targets during re-prefixing, any project with built Cargo artifacts in the SDK volume (paths like .../build/<crate>-<hash>/...) hit the limit and aborted save. - Use Entry::link_name() to resolve through GNU/PAX long-name extensions on read. - Use Builder::append_link() to emit long-name extensions on write for both hardlinks and symlinks. - Hardlink targets continue to be re-prefixed; symlink targets are preserved as-is (they reference filesystem paths, not archive paths).
mobileoverlord
approved these changes
May 1, 2026
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.
Problem
avocado saveaborts on any volume containing hardlinks whose targets exceed 100 bytes after theavocado-state/volume/archive prefix is applied. Cargo build artifacts in the SDK volume reliably trigger this:Root cause
The save loop cloned each entry's header and called
Header::set_link_namedirectly. Thetarcrate's header struct has a fixed 100-bytelinknamefield;set_link_namereturns an error rather than emitting a GNUKlong-link extension. Re-prefixing the target withavocado-state/volume/consistently pushes Cargo build paths past the limit.A latent issue also existed for symlinks with long original targets: the inner archive's
Kextension was implicitly resolved byEntry::link_name()butheader().clone()+append_datawould have silently truncated the target on output.Fix
Entry::link_name()so GNU/PAX long-name extensions are resolved on read.Builder::append_link()so the proper long-name extensions are emitted on write.Test plan
cargo buildcleancargo fmt --checkcleancargo clippyno new warningscargo test save— 7 existing tests still passavocado save --include-srcon a builtruntimes-devproject (4 GB volume with Cargo artifacts) succeeds and produces a 2 GB archiveavocado loadon the saved archive into a fresh directory,provision, thensdk run vm devboots successfully