Fix nil derefs in job run logging and tmpdir leak in terraform import#5141
Open
arsenyinfo wants to merge 1 commit intomainfrom
Open
Fix nil derefs in job run logging and tmpdir leak in terraform import#5141arsenyinfo wants to merge 1 commit intomainfrom
arsenyinfo wants to merge 1 commit intomainfrom
Conversation
Approval status: pending
|
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.
Changes
Three small bug fixes surfaced by a code review pass:
bundle/run/job.go— guardtask.StateinisFailed/isSuccessandrun.StateinlogFailedTasksagainst nil. The same file'sonProgressalready does this, so the inconsistency is a latent panic if the Jobs API ever returns a run/task with no state.bundle/run/job.go— in the--no-waitpath, check the error fromGetRunbefore dereferencingdetails.RunPageUrl. Previously a failedGetRunwould panic on the next line.bundle/deploy/terraform/import.go— movedefer os.RemoveAll(tmpDir)to immediately afterMkdirTempsucceeds. It was placed after two early-return paths (tf.Import/tf.Planfailures), so the temp dir leaked on those failures.Why
All three are unambiguous defects: two nil-pointer panic sites and one resource leak. No behavior change on the happy path.
Tests
bundle/runandbundle/deploy/terraformcover the happy paths and continue to pass behaviorally; the defended branches were previously panic / leak paths with no coverage.go buildis currently blocked by a flaky toolchain proxy (503 onproxy.golang.org); relying on CI to validate.