fix(erofs): remove tmp file on rename error#213
Open
austinvazquez wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #212 that ensures DumpVMDKDescriptorToFile best-effort cleans up its temporary merged_fs.vmdk.*.tmp file when the final os.Rename step fails, preventing stray temp files from persisting on rename errors.
Changes:
- Convert
DumpVMDKDescriptorToFileto use a named return error so a deferred cleanup can run on any returned error. - Add a deferred best-effort
os.Remove(tmpName)cleanup path when the function exits with an error (including rename failures).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hsiangkao
approved these changes
Jun 2, 2026
Signed-off-by: Austin Vazquez <austin.vazquez@docker.com>
c29f118 to
7805a43
Compare
Member
Author
|
@hsiangkao , sorry for the churn. I decided to dive into where my agent brought this tmp file + rename from and found it was just a minor comment from itself during its own review. Let's just revert it back to simply write the file with content. We can keep the unit tests though. WDYT? |
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.
Follow-up to #212
Revert the write to tmp, file sync + rename bits to simplify creating the vmdk files. I dove through the annals and found the review comment which sent my agent down this path. Let's remove it to simplify. This bit of code is not really executed concurrently for the current use case.