Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Conversation

@codysoyland
Copy link
Contributor

This code caused the singleton trustedRoot to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the if block:

-trustedRoot, err := root.NewTrustedRootFromJSON(targetBytes)
+trustedRoot, err = root.NewTrustedRootFromJSON(targetBytes)

Additionally, this PR removes some unused code managing a singleton error.

Fixes #177

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>
`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>
@codysoyland codysoyland requested review from a team and steiza as code owners September 17, 2024 21:34
@codysoyland codysoyland requested review from malancas and removed request for a team and steiza September 17, 2024 21:36
@codysoyland codysoyland merged commit 4db97ca into release Sep 17, 2024
12 of 69 checks passed
codysoyland added a commit that referenced this pull request Oct 10, 2024
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>
codysoyland added a commit that referenced this pull request Nov 18, 2024
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>
codysoyland added a commit that referenced this pull request Jan 7, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>
codysoyland added a commit that referenced this pull request Mar 27, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>
codysoyland added a commit that referenced this pull request Apr 10, 2025
* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>
jkylekelly pushed a commit that referenced this pull request Jul 24, 2025
Signed-off-by: Cody Soyland <[email protected]>

Sync TUF cache used for sigstore bundle verification (#166)

* sync tuf cache used for sigstore bundle verification

Signed-off-by: Meredith Lancaster <[email protected]>

* remove singleton err

Signed-off-by: Meredith Lancaster <[email protected]>

* start adding lock

Signed-off-by: Meredith Lancaster <[email protected]>

* Use RWMutex

Signed-off-by: Meredith Lancaster <[email protected]>

* pr feedback

Signed-off-by: Meredith Lancaster <[email protected]>

---------

Signed-off-by: Meredith Lancaster <[email protected]>

Fix shadowed trustedroot (#178)

* Fix shadowed variable bug

This code caused the singleton `trustedRoot` to be returned as nil on subsequent calls. The singleton was shadowed when the variable was redeclared in the `if` block.

Signed-off-by: Cody Soyland <[email protected]>

* Remove unused singleton

`singletonRootError` was never returned without being overwritten, so it was essentially unused. I think it's wise to always retry the TUF call on future invocations in case of network errors.

Signed-off-by: Cody Soyland <[email protected]>

---------

Signed-off-by: Cody Soyland <[email protected]>

Update go.mod

Signed-off-by: Cody Soyland <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

controller crashes with segmentation violation error when retrying to run an admissible pod

2 participants