updater: stage update artifacts in temporary directory instead of workdir#8302
Open
foxly-it wants to merge 2 commits intoAdguardTeam:masterfrom
Open
updater: stage update artifacts in temporary directory instead of workdir#8302foxly-it wants to merge 2 commits intoAdguardTeam:masterfrom
foxly-it wants to merge 2 commits intoAdguardTeam:masterfrom
Conversation
Comment on lines
+226
to
+229
| u.tempDir, err = os.MkdirTemp("", "agh-update-*") | ||
| if err != nil { | ||
| return fmt.Errorf("creating temporary update dir: %w", err) | ||
| } |
There was a problem hiding this comment.
The tempDir is created but never cleaned up if prepare() returns an error after creating the temporary directory. Consider adding a defer cleanup in the prepare() function to ensure the temporary directory is removed if any subsequent steps fail.
Author
There was a problem hiding this comment.
Good catch, thanks.
I added cleanup for the temporary directory if prepare() returns an error
after os.MkdirTemp() succeeds.
Closed
3 tasks
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
The updater currently stages update artifacts inside the configured working
directory (
workDir).On embedded systems (for example ARM devices, routers or minimal VPS setups)
this can lead to update failures when the working directory resides on a
constrained filesystem.
Solution
This PR stages update artifacts in a dedicated temporary directory created
via
os.MkdirTemp().The rest of the update workflow remains unchanged.
Benefits
Related issue
#8086