Skip to content
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

lib/repo-pull: Fix remote names in refspecs from non-mirror P2P pulls #1202

Closed
wants to merge 4 commits into from

Conversation

pwithnall
Copy link
Member

A set of commits to fix the situation where doing a non-mirror pull using the P2P functionality (ostree find-remotes --pull …) would result in the generated refs having an invalid remote name. They would use the name of the dynamic remote which the pull operation used, rather than a remote in repo/config which matches the collection ID for those refs.

See the commit messages for more details.

This set of commits depends on PR #1182, although I could possibly rebase it against master to avoid blocking on that. (Both PRs touch OstreeRepoFinderMount non-trivially.)

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably 2f9f722) made this pull request unmergeable. Please resolve the merge conflicts.

If override-remote-name is specified in the options to
ostree_repo_pull_with_options(), but the remote_name_or_baseurl argument
is also set to a remote name, the override-remote-name would be leaked.

Note that this is currently an invalid configuration, so this leak is
basically never hit.

Signed-off-by: Philip Withnall <[email protected]>
Instead of returning just the keyring filename, return the entire
OstreeRemote, which has the keyring filename as one of its members. This
will simplify some upcoming changes, and allows slightly improved debug
logging.

Signed-off-by: Philip Withnall <[email protected]>
When pulling from a dynamic (peer to peer) remote, the remote’s name is
set to a unique, generated string which doesn’t exist in repo/config. If
doing a non-mirror pull, however, we don’t want to use this name in the
refspecs for newly created or updated refs — we want to use the name of
the remote which provided the keyring for the pull (this will be a
remote from repo/config whose collection ID matches that being used for
the peer to peer pull).

Store both names in OstreeRemote. The name to use for refspecs is stored
as refspec_name, and is typically NULL unless it differs from name.

Signed-off-by: Philip Withnall <[email protected]>
Propagate the refspec_name from the OstreeRemote returned by an
OstreeRepoFinder through to the set_ref() call.

This changes ostree_repo_pull_with_options() to accept the
previously-disallowed combination of passing override-remote-name in
options and also setting a remote name in remote_name_or_baseurl.
ostree_repo_pull_with_options() will continue to pull using the remote
config named in remote_name_or_baseurl as before; but will now use the
remote name from override-remote-name when it’s setting the refs at the
end of the pull. This is consistent with the documentation for
override-remote-name.

Signed-off-by: Philip Withnall <[email protected]>
@pwithnall
Copy link
Member Author

Rebased now that #1182 has been merged; ready for review.

@cgwalters
Copy link
Member

This makes sense to me and the code all looks good. I have some lingering uncertainty which probably just boils down to me needing read more of the collections code and understand it more.

@rh-atomic-bot r+ d92a020

@rh-atomic-bot
Copy link

⌛ Testing commit d92a020 with merge 9d8c1ec...

rh-atomic-bot pushed a commit that referenced this pull request Sep 27, 2017
Instead of returning just the keyring filename, return the entire
OstreeRemote, which has the keyring filename as one of its members. This
will simplify some upcoming changes, and allows slightly improved debug
logging.

Signed-off-by: Philip Withnall <[email protected]>

Closes: #1202
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Sep 27, 2017
When pulling from a dynamic (peer to peer) remote, the remote’s name is
set to a unique, generated string which doesn’t exist in repo/config. If
doing a non-mirror pull, however, we don’t want to use this name in the
refspecs for newly created or updated refs — we want to use the name of
the remote which provided the keyring for the pull (this will be a
remote from repo/config whose collection ID matches that being used for
the peer to peer pull).

Store both names in OstreeRemote. The name to use for refspecs is stored
as refspec_name, and is typically NULL unless it differs from name.

Signed-off-by: Philip Withnall <[email protected]>

Closes: #1202
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Sep 27, 2017
Propagate the refspec_name from the OstreeRemote returned by an
OstreeRepoFinder through to the set_ref() call.

This changes ostree_repo_pull_with_options() to accept the
previously-disallowed combination of passing override-remote-name in
options and also setting a remote name in remote_name_or_baseurl.
ostree_repo_pull_with_options() will continue to pull using the remote
config named in remote_name_or_baseurl as before; but will now use the
remote name from override-remote-name when it’s setting the refs at the
end of the pull. This is consistent with the documentation for
override-remote-name.

Signed-off-by: Philip Withnall <[email protected]>

Closes: #1202
Approved by: cgwalters
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing 9d8c1ec to master...

@pwithnall pwithnall deleted the p2p-refspec-naming branch September 28, 2017 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants