Skip to content

Flatpak 1.2 backports - #3115

Closed
alexlarsson wants to merge 19 commits into
flatpak:flatpak-1.2.xfrom
alexlarsson:flatpak-1.2-backports
Closed

alexlarsson wants to merge 19 commits into
flatpak:flatpak-1.2.xfrom
alexlarsson:flatpak-1.2-backports

Conversation

@alexlarsson

Copy link
Copy Markdown
Member

No description provided.

matthiasclasen and others added 19 commits September 19, 2019 09:26
When an appstream update is cancelled while downloading
icons, properly fail. Otherwise, the next update attempt
will see an up-to-date timestamp, think everyhing is ok
and not download the missing icons.

Closes: flatpak#2835

Closes: flatpak#2836
Approved by: alexlarsson

(cherry picked from commit f28e62a)
If the buffer is too small, readlink() returns the number of bytes that
would have been stored if the buffer had been large enough.

Signed-off-by: Simon McVittie <[email protected]>

Closes: flatpak#2873
Approved by: matthiasclasen

(cherry picked from commit 89dc344)
We need to check whether the remote is gpg verified after handling
the oci case, because OCI is fine to update systemwide without gpg
verification (in fact it doesn't support verification).

This just reorders the code, matching what is done in the install
case already.

Closes: flatpak#2891
Approved by: alexlarsson

(cherry picked from commit 4c4c80b)
Toolbox [1] containers, like Flatpak containers, need to keep some
configuration files synchronized with the host. eg., /etc/localtime,
/etc/resolv.conf, etc.. The easiest way to keep them updated is to bind
mount the entire /etc from the host at some location inside the
container, and then replace the container's copy of the files with
symbolic links to the bind mounted copies.

However, this doesn't work when the host's copy of a configuration file
is itself a symbolic link to a location outside /etc. eg.,
/etc/localtime, which points somewhere inside /usr/share/zoneinfo. In
that case the host needs to be actively monitored via inotify(7) and
an updated copy of the file needs to maintained in a separate
directory, which can be bind mounted into the container.

This monitoring infrastructure is already present in Flatpak and it
makes sense to leverage it for Toolbox containers too.

However, Flatpak containers have only one user, the current one logged
into the host, whereas Toolbox containers have a longer list of users
like the host itself. Therefore, if the directory getting bind mounted
(ie., $XDG_RUNTIME_DIR/.flatpak-helper/monitor) isn't world readable,
then some users inside the container won't be able to read the
configuration file. eg., this will fail:
  $ sudo -u operator cat /run/host/monitor/localtime

Relaxing the directory permissions on the host shouldn't pose a
security risk. They are copies of originals that are world readable
anyway.

[1] https://github.com/debarshiray/toolbox

Closes: flatpak#2916
Approved by: alexlarsson

(cherry picked from commit bf96de9)
I spotted this line in the output from `flatpak history`:

    Jun  4 16:17:20	deploy install	com.discordapp.Discord	x86_64	stable	system	flathub	8a0fc700c701		Installed %s from %s	root (test)	flatpak-system-helper (gnome-software)	1.3.3

This is because the format string is passed as the 'url' parameter, the
first format parameter (the ref) is passed as the 'format' parameter,
and 'origin' is ignored because (fortunately) as far as I know, no
character significant to printf (like '%') is permitted in ref names.

Fix this by passing a NULL 'url', like the neighbouring call in
flatpak_dir_deploy_update().

(cherry picked from commit dbc90df)
(cherry picked from commit 5a16666)
Closes: flatpak#2954
Approved by: alexlarsson

(cherry picked from commit c87c480)

Closes: flatpak#2992
Approved by: alexlarsson

(cherry picked from commit 1ca3114)
Closes: flatpak#2954
Approved by: alexlarsson

(cherry picked from commit 9cd682b)

Closes: flatpak#2992
Approved by: alexlarsson

(cherry picked from commit cdc8d2d)
Closes: flatpak#2954
Approved by: alexlarsson

(cherry picked from commit da62f66)

Closes: flatpak#2992
Approved by: alexlarsson

(cherry picked from commit 40de350)
This works around an old polkit client library bug which would cause
a segfault in this situation. The bug was fixed long ago in upstream
polkit, but is still present in Debian 10 'buster', Ubuntu 19.04 'disco'
and all older releases, due to Debian/Ubuntu using a branch of polkit
to avoid the mozjs dependency. It should finally get fixed in Debian 11
and Ubuntu 19.10.

Signed-off-by: Simon McVittie <[email protected]>
Bug-Debian: https://bugs.debian.org/923046

Closes: flatpak#2997
Approved by: matthiasclasen

(cherry picked from commit 75b5b7c)
(cherry picked from commit 62cb645)
…_install_bundle()

Signed-off-by: Andre Moreira Magalhaes <[email protected]>

Closes: flatpak#3025
Approved by: matthiasclasen

(cherry picked from commit 37a7b6e)
(cherry picked from commit 47af6b3)
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: flatpak#3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
(cherry picked from commit 8ed03ef)
If the download URL for an icon was already cached locally, the HTTP
code returned FLATPAK_OCI_ERROR_NOT_CHANGED - this was treated as a real
error, and after downloading missing icons, all present icons were
deleted!

See https://bugzilla.redhat.com/show_bug.cgi?id=1683375

Closes: flatpak#3048
Approved by: alexlarsson

(cherry picked from commit a794c07)
(cherry picked from commit 767a9d5)
This prevents a crash in flatpak_installation_list_remotes_by_type() if
the `FlatpakDir` can’t ensure it has a repo configured.

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

Closes: flatpak#3028
Approved by: alexlarsson

(cherry picked from commit 791f318)
(cherry picked from commit 12cecc8)
We were only handling the old single-value 'version' key, even though
we handled the 'versions' key when finding remote related refs.

The result of this was that some extensions, such as the 19.08 opengl
default one was installed by default (as it was found as remote related)
yet still removed with --unused (as it was not locally related).

Fixes flatpak#3004

Closes: flatpak#3093
Approved by: mwleed

(manually cherry-picked from commit aa7b62a)
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)
This sets required-flatpak in the metadata to some different versions
and ensure we're properly able or not able to install it.

Additionally it uses some options with multiple versions. This is not
yet supported but I want to test the existing code and make sure it
properly falls back to just using the first element of the list.

Closes: flatpak#3112
Approved by: alexlarsson

(cherry picked from commit 6211730)
(cherry picked from commit 5db4631)
Support a list of versions that are supported. This will be useful
for e.g. the extra_data for extensions once that is backported to
1.2, because that will require it to say that it is supported for
> 1.2.5 in the 1.2 series and > 1.4.2 otherwise.

Closes: flatpak#3112
Approved by: alexlarsson

(cherry picked from commit 5026f01)
(cherry picked from commit 9bbe6fb)
@alexlarsson

Copy link
Copy Markdown
Member Author

@rh-atomic-bot r+

@rh-atomic-bot

Copy link
Copy Markdown

📌 Commit 6b46e72 has been approved by alexlarsson

@rh-atomic-bot

Copy link
Copy Markdown

⌛ Testing commit 6b46e72 with merge 1a6f10d...

rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
When an appstream update is cancelled while downloading
icons, properly fail. Otherwise, the next update attempt
will see an up-to-date timestamp, think everyhing is ok
and not download the missing icons.

Closes: #2835

Closes: #2836
Approved by: alexlarsson

(cherry picked from commit f28e62a)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
If the buffer is too small, readlink() returns the number of bytes that
would have been stored if the buffer had been large enough.

Signed-off-by: Simon McVittie <[email protected]>

Closes: #2873
Approved by: matthiasclasen

(cherry picked from commit 89dc344)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
We need to check whether the remote is gpg verified after handling
the oci case, because OCI is fine to update systemwide without gpg
verification (in fact it doesn't support verification).

This just reorders the code, matching what is done in the install
case already.

Closes: #2891
Approved by: alexlarsson

(cherry picked from commit 4c4c80b)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Toolbox [1] containers, like Flatpak containers, need to keep some
configuration files synchronized with the host. eg., /etc/localtime,
/etc/resolv.conf, etc.. The easiest way to keep them updated is to bind
mount the entire /etc from the host at some location inside the
container, and then replace the container's copy of the files with
symbolic links to the bind mounted copies.

However, this doesn't work when the host's copy of a configuration file
is itself a symbolic link to a location outside /etc. eg.,
/etc/localtime, which points somewhere inside /usr/share/zoneinfo. In
that case the host needs to be actively monitored via inotify(7) and
an updated copy of the file needs to maintained in a separate
directory, which can be bind mounted into the container.

This monitoring infrastructure is already present in Flatpak and it
makes sense to leverage it for Toolbox containers too.

However, Flatpak containers have only one user, the current one logged
into the host, whereas Toolbox containers have a longer list of users
like the host itself. Therefore, if the directory getting bind mounted
(ie., $XDG_RUNTIME_DIR/.flatpak-helper/monitor) isn't world readable,
then some users inside the container won't be able to read the
configuration file. eg., this will fail:
  $ sudo -u operator cat /run/host/monitor/localtime

Relaxing the directory permissions on the host shouldn't pose a
security risk. They are copies of originals that are world readable
anyway.

[1] https://github.com/debarshiray/toolbox

Closes: #2916
Approved by: alexlarsson

(cherry picked from commit bf96de9)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
I spotted this line in the output from `flatpak history`:

    Jun  4 16:17:20	deploy install	com.discordapp.Discord	x86_64	stable	system	flathub	8a0fc700c701		Installed %s from %s	root (test)	flatpak-system-helper (gnome-software)	1.3.3

This is because the format string is passed as the 'url' parameter, the
first format parameter (the ref) is passed as the 'format' parameter,
and 'origin' is ignored because (fortunately) as far as I know, no
character significant to printf (like '%') is permitted in ref names.

Fix this by passing a NULL 'url', like the neighbouring call in
flatpak_dir_deploy_update().

(cherry picked from commit dbc90df)
(cherry picked from commit 5a16666)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit c87c480)

Closes: #2992
Approved by: alexlarsson

(cherry picked from commit 1ca3114)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit 9cd682b)

Closes: #2992
Approved by: alexlarsson

(cherry picked from commit cdc8d2d)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit da62f66)

Closes: #2992
Approved by: alexlarsson

(cherry picked from commit 40de350)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
This works around an old polkit client library bug which would cause
a segfault in this situation. The bug was fixed long ago in upstream
polkit, but is still present in Debian 10 'buster', Ubuntu 19.04 'disco'
and all older releases, due to Debian/Ubuntu using a branch of polkit
to avoid the mozjs dependency. It should finally get fixed in Debian 11
and Ubuntu 19.10.

Signed-off-by: Simon McVittie <[email protected]>
Bug-Debian: https://bugs.debian.org/923046

Closes: #2997
Approved by: matthiasclasen

(cherry picked from commit 75b5b7c)
(cherry picked from commit 62cb645)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
…_install_bundle()

Signed-off-by: Andre Moreira Magalhaes <[email protected]>

Closes: #3025
Approved by: matthiasclasen

(cherry picked from commit 37a7b6e)
(cherry picked from commit 47af6b3)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit b44c1a5)
(cherry picked from commit 8ed03ef)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
If the download URL for an icon was already cached locally, the HTTP
code returned FLATPAK_OCI_ERROR_NOT_CHANGED - this was treated as a real
error, and after downloading missing icons, all present icons were
deleted!

See https://bugzilla.redhat.com/show_bug.cgi?id=1683375

Closes: #3048
Approved by: alexlarsson

(cherry picked from commit a794c07)
(cherry picked from commit 767a9d5)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
This prevents a crash in flatpak_installation_list_remotes_by_type() if
the `FlatpakDir` can’t ensure it has a repo configured.

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

Closes: #3028
Approved by: alexlarsson

(cherry picked from commit 791f318)
(cherry picked from commit 12cecc8)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
We were only handling the old single-value 'version' key, even though
we handled the 'versions' key when finding remote related refs.

The result of this was that some extensions, such as the 19.08 opengl
default one was installed by default (as it was found as remote related)
yet still removed with --unused (as it was not locally related).

Fixes #3004

Closes: #3093
Approved by: mwleed

(manually cherry-picked from commit aa7b62a)

Closes: #3115
Approved by: alexlarsson
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
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
This sets required-flatpak in the metadata to some different versions
and ensure we're properly able or not able to install it.

Additionally it uses some options with multiple versions. This is not
yet supported but I want to test the existing code and make sure it
properly falls back to just using the first element of the list.

Closes: #3112
Approved by: alexlarsson

(cherry picked from commit 6211730)
(cherry picked from commit 5db4631)

Closes: #3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Support a list of versions that are supported. This will be useful
for e.g. the extra_data for extensions once that is backported to
1.2, because that will require it to say that it is supported for
> 1.2.5 in the 1.2 series and > 1.4.2 otherwise.

Closes: #3112
Approved by: alexlarsson

(cherry picked from commit 5026f01)
(cherry picked from commit 9bbe6fb)

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

Copy link
Copy Markdown

☀️ Test successful - status-papr
Approved by: alexlarsson
Pushing 1a6f10d to flatpak-1.2.x...

alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
Closes: flatpak#2954
Approved by: alexlarsson

(cherry picked from commit c87c480)

Closes: flatpak#2992
Approved by: alexlarsson

(cherry picked from commit 1ca3114)

Closes: flatpak#3115
Approved by: alexlarsson

(cherry picked from commit f746373)
alexlarsson pushed a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
Closes: flatpak#2954
Approved by: alexlarsson

(cherry picked from commit 9cd682b)

Closes: flatpak#2992
Approved by: alexlarsson

(cherry picked from commit cdc8d2d)

Closes: flatpak#3115
Approved by: alexlarsson

(cherry picked from commit 4b7963f)
alexlarsson added a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
This sets required-flatpak in the metadata to some different versions
and ensure we're properly able or not able to install it.

Additionally it uses some options with multiple versions. This is not
yet supported but I want to test the existing code and make sure it
properly falls back to just using the first element of the list.

Closes: flatpak#3112
Approved by: alexlarsson

(cherry picked from commit 6211730)
(cherry picked from commit 5db4631)

Closes: flatpak#3115
Approved by: alexlarsson

(cherry picked from commit cf13a14)
alexlarsson added a commit to alexlarsson/flatpak that referenced this pull request Sep 19, 2019
Support a list of versions that are supported. This will be useful
for e.g. the extra_data for extensions once that is backported to
1.2, because that will require it to say that it is supported for
> 1.2.5 in the 1.2 series and > 1.4.2 otherwise.

Closes: flatpak#3112
Approved by: alexlarsson

(cherry picked from commit 5026f01)
(cherry picked from commit 9bbe6fb)

Closes: flatpak#3115
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit c87c480)

Closes: #2992
Approved by: alexlarsson

(cherry picked from commit 1ca3114)

Closes: #3115
Approved by: alexlarsson

(cherry picked from commit f746373)

Closes: #3117
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit 9cd682b)

Closes: #2992
Approved by: alexlarsson

(cherry picked from commit cdc8d2d)

Closes: #3115
Approved by: alexlarsson

(cherry picked from commit 4b7963f)

Closes: #3117
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
This sets required-flatpak in the metadata to some different versions
and ensure we're properly able or not able to install it.

Additionally it uses some options with multiple versions. This is not
yet supported but I want to test the existing code and make sure it
properly falls back to just using the first element of the list.

Closes: #3112
Approved by: alexlarsson

(cherry picked from commit 6211730)
(cherry picked from commit 5db4631)

Closes: #3115
Approved by: alexlarsson

(cherry picked from commit cf13a14)

Closes: #3117
Approved by: alexlarsson
rh-atomic-bot pushed a commit that referenced this pull request Sep 19, 2019
Support a list of versions that are supported. This will be useful
for e.g. the extra_data for extensions once that is backported to
1.2, because that will require it to say that it is supported for
> 1.2.5 in the 1.2 series and > 1.4.2 otherwise.

Closes: #3112
Approved by: alexlarsson

(cherry picked from commit 5026f01)
(cherry picked from commit 9bbe6fb)

Closes: #3115
Approved by: alexlarsson

Closes: #3117
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.

10 participants