Skip to content

Avoid adding duplicate remotes due to trailing slash confusion - #3065

Closed
mwleeds wants to merge 3 commits into
flatpak:masterfrom
mwleeds:normalize-remote-urls
Closed

mwleeds wants to merge 3 commits into
flatpak:masterfrom
mwleeds:normalize-remote-urls

Conversation

@mwleeds

@mwleeds mwleeds commented Aug 20, 2019

Copy link
Copy Markdown
Contributor

Fixes #2979

@mwleeds

mwleeds commented Aug 20, 2019

Copy link
Copy Markdown
Contributor Author

I guess ideally Flatpak could also detect if an installation has duplicate remotes and try to remedy the situation, but that could be significantly more work. Hopefully people can just delete the duplicate.

@mwleeds
mwleeds requested a review from alexlarsson August 24, 2019 00:56
@rh-atomic-bot

Copy link
Copy Markdown

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

@alexlarsson

Copy link
Copy Markdown
Member

Hmmm. This isn't correct for OCI uris, because for those wan can use a query part on the url, (like url=oci+http://localhost:5000/api/v1/organization/flattest?index=labels).

Maybe we want a bit more complex matching, doing the above checks on the part before '?', and then a regular compare on the rest (if any).

@mwleeds

mwleeds commented Sep 12, 2019

Copy link
Copy Markdown
Contributor Author

Hmmm. This isn't correct for OCI uris, because for those wan can use a query part on the url, (like url=oci+http://localhost:5000/api/v1/organization/flattest?index=labels).

Maybe we want a bit more complex matching, doing the above checks on the part before '?', and then a regular compare on the rest (if any).

I checked that the trailing slash doesn't make a difference when the URL is interpreted by libostree, but for an OCI URL I don't think that's a safe assumption. In general the trailing slash matters according to https://blog.cdivilly.com/2019/02/28/uri-trailing-slashes

Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes flatpak#2979
@mwleeds
mwleeds force-pushed the normalize-remote-urls branch from 20b4c56 to 5d52f01 Compare September 12, 2019 21:01
@alexlarsson

Copy link
Copy Markdown
Member

@rh-atomic-bot r+

@rh-atomic-bot

Copy link
Copy Markdown

📌 Commit 5d52f01 has been approved by alexlarsson

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 5d52f01 with merge 07ab6e3...

rh-atomic-bot pushed a commit that referenced this pull request Sep 13, 2019
Closes: #3065
Approved by: alexlarsson
@rh-atomic-bot

Copy link
Copy Markdown

☀️ Test successful - status-papr
Approved by: alexlarsson
Pushing 07ab6e3 to master...

@mwleeds
mwleeds deleted the normalize-remote-urls branch September 13, 2019 17:09
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 18, 2019
Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes flatpak#2979

Closes: flatpak#3065
Approved by: alexlarsson

(cherry picked from commit af4504c)
rh-atomic-bot pushed a commit that referenced this pull request Sep 18, 2019
Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes #2979

Closes: #3065
Approved by: alexlarsson

(cherry picked from commit af4504c)

Closes: #3111
Approved by: alexlarsson
alexlarsson pushed a commit that referenced this pull request Sep 18, 2019
Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes #2979

Closes: #3065
Approved by: alexlarsson

(cherry picked from commit af4504c)
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes flatpak#2979

Closes: flatpak#3065
Approved by: alexlarsson

(cherry picked from commit 866ba64)
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Currently if you have a remote configured with the URL
"https://dl.flathub.org/repo/" (as you would if you use the flatpakrepo
file) and you use a flatpakref file which specifies the URL
"https://dl.flathub.org/repo", Flatpak tries to add a duplicate remote
because it doesn't see those URLs as equal. So ignore the trailing slash
when comparing remote URLs. OSTree works equally well with both kinds
(it uses g_build_filename()).

Flathub served flatpakref files with URLs missing a trailing slash until
this commit:
flathub-infra/ansible@b20694f09

Also, add a unit test that fails without this patch.

Fixes #2979

Closes: #3065
Approved by: alexlarsson

(cherry picked from commit 866ba64)

Closes: #3115
Approved by: alexlarsson
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.

Flatpak adds a duplicate Flathub remote

3 participants