Repository navigation
[Backport release-2.4] Don't cache truncated package downloads in xpkg - #1200
Merged
Merged
Conversation
CachedClient.Get copies the package stream into the package cache through a pipe while it parses it. The parser closes its reader even when parsing fails, and closing the tee reader closed the pipe cleanly. So when a download failed partway, FsPackageCache.Store saw a normal EOF and cached a valid gzip that held only a prefix of package.yaml. The next Get hit the cache, parsed the prefix without error, and returned a package that was missing most of its objects. Give the parser only the package content to close, and close the pipe with the parse error once Parse returns, so Store fails instead of caching a prefix. Get now waits for Store to finish before returning. Also make Store write to a temporary file and rename it into place only after the content has been written and synced, removing the temporary file on any error. The cache then never holds a partially written package under its real name. Signed-off-by: ezgidemirel <ezgidemirel91@gmail.com> (cherry picked from commit 6ccb301)
2 of 5 tasks
bobh66
approved these changes
Oct 15, 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.
Description
Backport of #1189 to
release-2.4.