-
-
Notifications
You must be signed in to change notification settings - Fork 73
Harden restore, storage, and post-install error handling, and more #212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
a0aa3f6
Fix post-install TUI Disable All action
tis24dev b785bb4
Fix post-install TUI and email delivery defaults
tis24dev 70720c2
Fix post-install TUI, email fallback, and filesystem checks
tis24dev 60aa62c
Make BASE_DIR runtime-detected
tis24dev d71c25d
fix: Deferred cleanup won't execute when close fails
tis24dev af0d664
fix restore UI EOF normalization
tis24dev 8fd0377
fix restore cleanup after prepare errors & fix TFA prompt with nil lo…
tis24dev 60b3aae
fix restore service cleanup on prepare abort
tis24dev f914454
fix PBS notification nil logger warnings
tis24dev cc7f161
fix mount guard double probe race
tis24dev 01c9bd0
fix PVE storage subdir error propagation
tis24dev ce16834
fix PBS datastore subdir error propagation
tis24dev 9bc2918
fsync PBS datastore config writes
tis24dev 8069de2
Tighten ZFS mount path heuristics
tis24dev b27d88e
Fix datastore mode enforcement without backup user
tis24dev e3e7512
Preserve spaces in parsed config paths
tis24dev 65b04ab
Remove partial restore files on write failures
tis24dev 9bc0892
Sanitize email address headers
tis24dev 4eec7ed
Clear stale log file handle on close failure
tis24dev 70cc1b4
Escape email HTML status values
tis24dev 1255294
Cancel PXAR workers on first error
tis24dev 2b28afa
Return compressor start errors
tis24dev e6baa4e
Use form wrapper in password field test
tis24dev 272c2e5
Rename rollback UI error logger
tis24dev e28d05c
Name network apply confirm timeout
tis24dev 85cafb6
Make interface name detection tests deterministic
tis24dev 0abff37
Normalize safeexec factory formatting
tis24dev 874b0f8
Retry permission checks on close EIO
tis24dev 66d9ce4
Defer temp symlink cleanup
tis24dev 584a226
Avoid duplicate lock close logging
tis24dev 3141652
Document lock close failure test setup
tis24dev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "path/filepath" | ||
| "sync" | ||
| "testing" | ||
| ) | ||
|
|
||
| func forceDetectedBaseDirForTest(t *testing.T, baseDir string) { | ||
| t.Helper() | ||
| origInfo := execInfo | ||
| origOnce := execInfoOnce | ||
|
|
||
| execPath := filepath.Join(baseDir, "build", "proxsave") | ||
| execInfo = ExecInfo{ | ||
| ExecPath: execPath, | ||
| ExecDir: filepath.Dir(execPath), | ||
| BaseDir: baseDir, | ||
| HasBase: true, | ||
| } | ||
| execInfoOnce = sync.Once{} | ||
| execInfoOnce.Do(func() {}) | ||
|
|
||
| t.Cleanup(func() { | ||
| execInfo = origInfo | ||
| execInfoOnce = origOnce | ||
| }) | ||
| } | ||
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: sync.Once must not be copied.
Lines 12 and 26 copy
sync.Onceby value, which is forbidden becausesync.Oncecontainssync.noCopyto prevent exactly this. Copying synchronization primitives can cause race conditions and undefined behavior.🔒 Proposed fix: use pointer to avoid copying
func forceDetectedBaseDirForTest(t *testing.T, baseDir string) { t.Helper() origInfo := execInfo - origOnce := execInfoOnce + origOnce := &execInfoOnce execPath := filepath.Join(baseDir, "build", "proxsave") execInfo = ExecInfo{ ExecPath: execPath, ExecDir: filepath.Dir(execPath), BaseDir: baseDir, HasBase: true, } - execInfoOnce = sync.Once{} + newOnce := sync.Once{} + newOnce.Do(func() {}) + execInfoOnce = newOnce - execInfoOnce.Do(func() {}) t.Cleanup(func() { execInfo = origInfo - execInfoOnce = origOnce + execInfoOnce = *origOnce }) }Also applies to: 26-26
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 12-12: copylocks: assignment copies lock value to origOnce: sync.Once contains sync.noCopy
(govet)
🤖 Prompt for AI Agents