Commit Graph

5116 Commits

Author SHA1 Message Date
Matthew Leeds
866ba643d2 dir: Ignore trailing slash in remote URIs
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:
https://github.com/flathub/ansible-playbook/commit/b20694f09

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

Fixes https://github.com/flatpak/flatpak/issues/2979

Closes: #3065
Approved by: alexlarsson

(cherry picked from commit af4504c8d3)
2019-09-18 19:21:47 +02:00
Alexander Larsson
aa7b62a0bf Handle 'versions' key when finding local related ref
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 https://github.com/flatpak/flatpak/issues/3004

Closes: #3093
Approved by: mwleed

(manually cherry-picked from commit e4b1d16b7d)
2019-09-18 19:21:47 +02:00
Alexander Larsson
7844735dcf Fix leak in flatpak_dir_find_remote_related_for_metadata
This puts the checksum autoptr in the inner scope of the loop where
it gets assigned to avoid leaking all but the last iteration value.

Closes: #3093
Approved by: mwleeds

(cherry picked from commit ca72dd5474)
2019-09-18 19:21:47 +02:00
Philip Withnall
12cecc852c flatpak-installation: Handle an unconfigured remote when listing remotes
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 <withnall@endlessm.com>

Closes: #3028
Approved by: alexlarsson

(cherry picked from commit 791f31898b)
2019-09-18 19:21:47 +02:00
Owen W. Taylor
767a9d5a43 OCI: correctly handle locally present icons
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 a794c07e18)
2019-09-18 19:21:47 +02:00
Matthew Leeds
19b5033942 build-bundle: Fix resolving refs
Unfortunately in commit 253fcc6e3 I broke the build-bundle command so
that it is unable to resolve remote refs (as opposed to local ones).
This means in the normal case of building a bundle for an app installed
from a remote it fails:

$ flatpak build-bundle /var/lib/flatpak/repo gnome-calculator.flatpak org.gnome.Calculator stable
error: Refspec 'app/org.gnome.Calculator/x86_64/stable' not found

This is because flatpak_repo_resolve_rev() interprets a NULL remote name
to mean the ref is local (in refs/heads/) but in this case we just don't
know which remote it's from. This commit fixes the issue by using
ostree_repo_resolve_rev() directly which searches refs/heads/ and
refs/remotes/, and if that fails falling back to iterating over refs
returned by ostree_repo_list_collection_refs() to catch collection-refs
that may be in refs/mirrors/.

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

Fixes https://github.com/flatpak/flatpak/issues/3026

Closes: #3032
Approved by: alexlarsson

(cherry picked from commit 5e65174e8d)
2019-09-18 19:21:47 +02:00
Matthew Leeds
8ed03ef61e dir: Don't overzealously rewrite an error
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 b44c1a5799)
2019-09-18 19:21:47 +02:00
Andre Moreira Magalhaes
47af6b39b9 transaction: Append bundle to correct list on flatpak_transaction_add_install_bundle()
Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>

Closes: #3025
Approved by: matthiasclasen

(cherry picked from commit 37a7b6edfd)
2019-09-18 19:21:47 +02:00
Simon McVittie
62cb645171 Don't register polkit agent if we cannot connect to system bus
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 <smcv@collabora.com>
Bug-Debian: https://bugs.debian.org/923046

Closes: #2997
Approved by: matthiasclasen

(cherry picked from commit 75b5b7c763)
2019-09-18 19:21:47 +02:00
Alexander Larsson
f70978b4ad Update pofiles for release 1.4.2 2019-06-28 13:06:56 +02:00
Alexander Larsson
94fc69e058 Bump version to 1.4.2 2019-06-28 12:55:20 +02:00
Alexander Larsson
4a3b254021 Update NEWS for 1.4.2 2019-06-28 12:55:02 +02:00
Matthew Leeds
944e7bf381 common/flatpak-dir-private.h: Fix order of arguments
This issue was introduced by commit 5da7a0411.

Fixes https://github.com/flatpak/flatpak/issues/2966

Closes: #2968
Approved by: matthiasclasen

(cherry picked from commit 1ce250b5bd)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Matthew Leeds
3f8a68e40f main: Handle double slashes in $XDG_DATA_DIRS
When checking for Flatpak directories in $XDG_DATA_DIRS, treat
/example//path/ as equivalent to /example/path/.

Fixes https://github.com/flatpak/flatpak/issues/2989

Closes: #2990
Approved by: alexlarsson

(cherry picked from commit 4fd7d7d209)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Ryan Gonzalez
40de35049a doc: Document ExtensionOf.runtime
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit da62f665da)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Ryan Gonzalez
cdc8d2deb5 dir: Use ExtensionOf.runtime for apply_extra
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit 9cd682b057)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Ryan Gonzalez
1ca31146d3 transaction: Install an extension's required runtime
Closes: #2954
Approved by: alexlarsson

(cherry picked from commit c87c480a18)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Ryan Gonzalez
e4bf242764 build-init: Export an extension's runtime in the metadata
Without this, extensions cannot use extra-data, as there is no
indication of what runtime to run apply_extra in.

Closes: #2954
Approved by: alexlarsson

(cherry picked from commit 7222a83678)

Closes: #2992
Approved by: alexlarsson
2019-06-28 10:50:57 +00:00
Alexander Larsson
663b5cd370 Update pofiles for release 1.4.1 2019-06-13 10:47:10 +02:00
Alexander Larsson
8857cf1d7e Update NEWS for release 2019-06-13 10:12:46 +02:00
Alexander Larsson
45118ab1f5 Update Version to 1.4.1 2019-06-13 10:12:36 +02:00
Ryan Gonzalez
d17f4487c3 revokefs-fuse: Fix some build warnings
Closes: #2952
Approved by: alexlarsson

(cherry picked from commit 2b93928285)
2019-06-13 10:07:26 +02:00
Richard Hughes
8b42f89e7a Do not break ABI and cause gnome-software to crash
This restores the ABI to the pre-1.4.0 version. This moves the new signal to
the *end* of the struct and also correctly decrements the padding.

Fixes https://github.com/flatpak/flatpak/issues/2957, although we probably need
a 1.4.1 release with this included pretty quickly to avoid chaos.

Closes: #2958
Approved by: alexlarsson

(cherry picked from commit 4f327649fd)
2019-06-13 10:07:26 +02:00
Alexander Larsson
a24e2b3e36 transaction: Add back support for file: uris in RuntimeRepo keys
This used to work, and the gnome-software test suite relies on it,
so add it back. I believe it regressed in
 https://github.com/flatpak/flatpak/pull/2740

This fixes https://github.com/flatpak/flatpak/issues/2955

Closes: #2956
Approved by: alexlarsson

(cherry picked from commit 1029f2b1d0)
2019-06-13 10:07:26 +02:00
Ryan Gonzalez
96eb8837a8 remote-delete: Manually delete origin remotes if no refs were removed
There are a few cases where -origin remotes don't get removed when
their refs are uninstalled, most notably when xa.noenumerate is set, or
somehow the uninstall gets interrupted at the wrong time. Regardless
of the reason, the remote could never be removed after this, unless a
new ref is installed from it and then removed, or noenumerate is set.

Closes: #2920

Closes: #2953
Approved by: alexlarsson

(cherry picked from commit 71fcf99b2e)
2019-06-13 10:07:26 +02:00
Simon McVittie
641121440b icon-validator: Remove remnants of GSpawn error handling
Now that validate-icon uses execvpe(), status and error were never set,
so rerun_in_sandbox() would have crashed while dereferencing a NULL
error if execvpe() failed. This is reproducible with, for example:

    FLATPAK_BWRAP=/bin/nope flatpak-validate-icon --sandbox 48 48 /path/to/icon

execvpe() does not return on success (the process image is replaced),
and sets errno on failure, so behave accordingly.

Also print the error message to stderr, even if G_MESSAGES_DEBUG is not
set, since it's our only opportunity to indicate to a caller what has
gone wrong.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2950
Approved by: alexlarsson

(cherry picked from commit 8deef94f9d)
2019-06-13 10:07:25 +02:00
Ryan Gonzalez
bfb7d4217a app: Avoid a potential segfault when skipping columns
Closes: #2942
Approved by: mwleeds

(cherry picked from commit cd231503f2)
2019-06-13 10:07:25 +02:00
Will Thompson
5a16666bdc dir: include NULL url in flatpak_dir_log() call
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 dbc90df513)
2019-06-13 10:07:25 +02:00
Matthew Leeds
f44c70e7dc Merge pull request #2926 from piotrdrag/pl-update-190528-1.4.x
Update Polish translation for flatpak-1.4.x
2019-06-07 12:34:35 -07:00
AsciiWolf
f4818db612 Update Czech translation
Closes: #2940
Approved by: mwleeds
2019-06-07 04:20:36 +00:00
Piotr Drąg
5584b46fcc Update Polish translation
Closes: #2926
Approved by: matthiasclasen
2019-05-31 11:57:38 +00:00
Piotr Drąg
8026160dc5 Update Polish translation 2019-05-28 19:44:13 +02:00
Alexander Larsson
170b0e2b8e Update pofiles 1.4.0 2019-05-28 15:07:09 +02:00
Alexander Larsson
3e8c42c823 Bump version to 1.4.0 2019-05-28 14:55:02 +02:00
Alexander Larsson
f8c13c8007 Update NEWS for 1.4.0 2019-05-28 14:54:44 +02:00
Valentin David
8d82a3e5f7 app/flatpak-builtins-build-commit-from.c: Recalculate download-size metadata
Download size of object depends on the compression used in the ostree
repository.  When a different source repository is specified, download
size might change.  So this metadata needs to be recalculated.

This issue happens with Freedesktop SDK which for build time
optimization reason run an intermediate build-export on a bare
repository.

See issue https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/787

Closes: #2925
Approved by: alexlarsson
2019-05-28 12:46:13 +00:00
Debarshi Ray
bf96de941b session-helper: Relax directory permission for Toolbox containers
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
2019-05-28 07:37:13 +00:00
Matthew Leeds
3164c68e31 common: Fix double free of GError
Closes: #2919
Approved by: alexlarsson
2019-05-27 10:58:33 +00:00
Kukuh Syafaat
b0ad7003bc Update Indonesian translation
Closes: #2915
Approved by: matthiasclasen
2019-05-23 11:20:20 +00:00
Matthew Leeds
c028e0dc1b installation: Use FLATPAK_ERROR_REF_NOT_FOUND in one more place
I missed this when adding FLATPAK_ERROR_REF_NOT_FOUND.

Closes: #2914
Approved by: matthiasclasen
2019-05-21 02:06:00 +00:00
Matthew Leeds
584edb67d5 README: Add LGTM badge for Python
Hopefully we can get the one for C working too.

Closes: #2894
Approved by: matthiasclasen
2019-05-16 23:56:24 +00:00
Matthew Leeds
f9a4b44c64 flatpak-bisect: Remove unused variable
This fixes a warning pointed out by lgtm.com. I checked that the following
still works:
$ PAGER=more flatpak-bisect -b stable org.gnome.Builder log

Closes: #2894
Approved by: matthiasclasen
2019-05-16 23:56:24 +00:00
Alexander Larsson
b53f937d7e Fix installable tests when running on a tty
This sets FLATPAK_FANCY_OUTPUT=0 in most tests and then special cases
the test_fancy_output() test in case the installable tests are running
on an actual tty. This was causing failures because the added bold escapes
caused some test cases to not generate the expected output.

Closes: #2907
Approved by: alexlarsson
2019-05-16 15:24:47 +00:00
Matthew Leeds
c0d5f1bfc8 Add FLATPAK_ERROR_REF_NOT_FOUND
This adds a new error to FlatpakError and uses it everywhere a ref is not
found, either locally or in a remote. This should hopefully be more useful than
the status quo of either returning FLATPAK_ERROR_INVALID_DATA or
G_IO_ERROR_NOT_FOUND or something else. Technically this is an API break but it
seems worth the risk. I checked gnome-software which does not seem affected by
this, and I checked eos-updater which does check for G_IO_ERROR_NOT_FOUND in
one place that will be affected by this but we can patch that.

Closes: #2895
Approved by: matthiasclasen
2019-05-13 10:57:11 +00:00
Matthew Leeds
9a09001317 common/flatpak-error: Fix a typo
Closes: #2895
Approved by: matthiasclasen
2019-05-13 10:57:11 +00:00
Serdar Sağlam
165234041e Update tr.po
Hi
Missing and incorrect translation arrangement. Incomplete
Closes: #2896
Approved by: matthiasclasen
2019-05-13 10:41:58 +00:00
Alexander Larsson
4abc170f9b Update po/ for release 1.3.4 2019-05-10 09:19:25 +02:00
Alexander Larsson
4947fa6e44 fix distcheck: Pass -f to rm to avoid interactive prompt 2019-05-10 09:07:41 +02:00
Alexander Larsson
1b2207c64e tests: Fix distcheck (test.filter is in srcdir, not builddir) 2019-05-10 08:59:41 +02:00
Alexander Larsson
c369699122 Update NEWS for release 2019-05-09 15:49:51 +02:00