Skip to content
This repository was archived by the owner on Feb 14, 2024. It is now read-only.

tuf code might have race conditions #16

Closed
groob opened this issue Jun 26, 2017 · 0 comments
Closed

tuf code might have race conditions #16

groob opened this issue Jun 26, 2017 · 0 comments
Labels

Comments

@groob
Copy link
Contributor

groob commented Jun 26, 2017

I'm working on #13 to add a Download method which downloads a specific target.
In order for the download method to work, it must call refresh() first to update all the local metadata from Notary. The refresh method works by updating pointers on a struct, and is also called by the updater loop which runs on a timer.
This new way of using the code will result in race conditions.

	root, err := rs.refreshRoot()
	if err != nil {
		return "", errors.Wrap(err, "refreshing root")
	}
	// cache the current root
	rs.root = root
	timestamp, err := rs.refreshTimestamp(root)
	if err != nil {
		return "", errors.Wrap(err, "refreshing timestamp")
	}
	rs.timestamp = timestamp
@groob groob added the bug label Jun 26, 2017
@groob groob closed this as completed in #20 Jun 27, 2017
groob added a commit that referenced this issue Jun 27, 2017
* add download method for updater

Closes #13

In the process of adding the method also discovered and updated the potentially race-y usage of the repoManager struct.

Closes #16 but full fix should come in with #22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant