Commit Graph

6972 Commits

Author SHA1 Message Date
Simon McVittie
0728b97e22 test-history: Make it easier to debug on failure
If `flatpak history` fails, let's show the log file before failing
the test.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
3e8319c9b4 tests: Factor out generation of test runtime into a script
This will make it easier to invoke from Meson.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
1082201be9 tests/update-test-matrix: Move into a standalone script
This will allow the same script to be used to generate
Makefile-test-matrix.am.inc and its Meson equivalent.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
f090f1a1f3 tests: Wrap EXTRA_DIST, one file per line
This will reduce conflicts when adding more files.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
aef1442d54 icon-validator: Don't make flatpak_get_bwrap() extern
The Meson build files that I'm working on enable more compiler warnings
by default than Autotools does, and in particular -Wmissing-declarations
complains about global functions that are not predeclared. There's no
need for this one to be global.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
2bfd373d6d selinux: Factor out build steps into a script
This will make them easier to share between Autotools and Meson.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
91b38f64c2 utils: Put an Auto prefix on locally-defined autoptr cleanups
As with commit de9fe1cb "common: Work around new glib codegen
autogenerating g_autoptr support", this avoids colliding with newer
versions of gdbus-codegen generating their own autocleanups. This is
helpful when using Meson, in which the gdbus-codegen integration
generates more autocleanups by default.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Simon McVittie
134950e337 .gitignore: Be more specific about what we ignore
When we add a Meson build system, we will need to add a meson.build in the
subdirectories that were ignored by these rules. Ignore individual files
instead of entire subdirectories.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-05-03 13:54:23 +02:00
Debarshi Ray
8617ab0ad0 selinux: Permit read access to /var/lib/flatpak
It's clearly quite important to have read access to /var/lib/flatpak
and it's contents.  This explicitly permits that to avoid running
into SELinux denials.

https://bugzilla.redhat.com/show_bug.cgi?id=2070741
2022-04-23 16:13:00 +01:00
Debarshi Ray
f8a9153d0e selinux: Let the system helper watch files inside $libexecdir
The system-helper (ie., the `flatpak-system-helper` process) is
labelled with flatpak_helper_exec_t and runs in the flatpak_helper_t
domain, and tries to set up an inotify(7) watch on it's own binary so
that it can exit when the binary is replaced.  This explicitly permits
it to do so to avoid running into SELinux denials.

The corecmd_watch_bin_dirs SELinux interface is a recent addition [1],
and is therefore used conditionally when defined.

[1] https://github.com/fedora-selinux/selinux-policy/commit/88072fd293
    https://github.com/fedora-selinux/selinux-policy/pull/1133

https://bugzilla.redhat.com/show_bug.cgi?id=2053634
2022-04-23 16:13:00 +01:00
Phaedrus Leeds
45d86effce tests: Remove a pointless test
Typo correction has nothing to do with --no-pull or --no-deploy so it
doesn't make sense to test them together when we already test each
separately.

[smcv: Resolve conflict with #4858]
2022-04-23 16:12:53 +01:00
Phaedrus Leeds
b95525eae2 doc/flatpak-run: Update docs about env vars 2022-04-23 14:54:58 +01:00
Phaedrus Leeds
f4727eacb6 doc/flatpak-run: Add more info 2022-04-23 14:54:58 +01:00
Phaedrus Leeds
239706c9c1 uninstall: Make help message more accurate 2022-04-23 14:54:58 +01:00
Debarshi Ray
002e4455d8 selinux: Let the system helper have read access to /etc/passwd
The system-helper (ie., the `flatpak-system-helper` process) is
labelled with flatpak_helper_exec_t and runs in the flatpak_helper_t
domain, and needs to be able to read /etc/passwd.  This explicitly
permits it to do so to avoid running into SELinux denials.

https://bugzilla.redhat.com/show_bug.cgi?id=2070350
2022-04-21 20:57:52 +01:00
Phaedrus Leeds
c7d262b375 app: Disable fuzzy matching if not on a tty
As discussed in #4848, this disables fuzzy matching entirely if stdin or
stdout is not a tty, meaning that something like "flatpak install
firefox" would be treated as incorrect syntax, since this syntax is
intended for interactive CLI use. Even before this commit, "flatpak
install firefox" would error out if run without a tty, since we don't
automatically choose a matching app ID even if there is only one match.
However "flatpak install -y firefox" could work before, but won't any
more. People should be specifying the full app ID in any context other
than a tty.

This commit also introduces a new env var so the unit tests can continue
to check the fuzzy matching behavior, despite them being run without a
tty.
2022-04-21 20:53:46 +01:00
Phaedrus Leeds
5acb4ee7e4 app: Disable fuzzy ref matching when id has a period
As discussed in #4848, this disables fuzzy matching when the string
given has a period in it. So for example "flatpak install org.mozilla"
would not offer "org.mozilla.firefox" even though the string given is a
substring of the app ID. This is desirable because it helps ensure fuzzy
matching is only used when the user intended to use it.

As with the previous commit that fixed #4829, this does technically
break backwards compatibility, but only in an interface intended for
interactive use by a human, not an interface that's used
programmatically, so it seems okay.
2022-04-21 20:53:46 +01:00
Phaedrus Leeds
23926b7090 app: Disable fuzzy ref matching when id has a slash
Fixes https://github.com/flatpak/flatpak/issues/4829
2022-04-21 20:53:46 +01:00
Phaedrus Leeds
9e6b28daf5 uninstall: Make error message prettier
The "*unspecified*" bits are ugly, and the ref/arch/branch syntax is
especially confusing when we're doing fuzzy matching, since it implies
the id was searched for exactly.
2022-04-19 15:38:44 +01:00
Phaedrus Leeds
a30ef8f007 uninstall: Error out when all refs are invalid
Currently if you specify one non-existent ref to the uninstall command,
it exits with a non-zero status:

$ flatpak uninstall notaflatpak
error: notaflatpak/*unspecified*/*unspecified* not installed

...but if you specify more than one non-existent ref you get warnings
for each and a zero exit status:

$ flatpak uninstall notaflatpak alsonot
Warning: notaflatpak is not installed
Warning: alsonot is not installed

So make the latter case error out like the former.
2022-04-19 15:38:44 +01:00
Simon McVittie
8ad534f65c common: Decouple flatpak-context-private.h from xdg-dbus-proxy
If we're using a system copy of xdg-dbus-proxy, it's not really correct
to include a header from our subproject (which we are otherwise not
going to be compiling), and Meson is stricter about this than Autotools.
Instead, duplicate the FlatpakPolicy enum, which is the only part we
actually need.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-11 10:32:34 +02:00
Simon McVittie
c68f31d86a build: Consistently include libglnx header as "libglnx.h"
Recent Meson versions have warnings if you add the subprojects
directory as an include path, because the way Meson wants to consume
subprojects is by the subproject's build system producing a Meson
dependency object that encapsulates its include directory. Flatpak
doesn't have a Meson build system yet, but I'm working on that.

libglnx seems to be set up to have the libglnx directory be its include
path instead: for example, ostree (by the author of libglnx) already
uses "libglnx.h" or <libglnx.h> everywhere. Do the same here.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-04-11 10:32:34 +02:00
Phaedrus Leeds
03f11864b9 Improve --sideload-repo option to take create-usb dirs
Currently, when using the sideloading support for offline updates, there
are two types of directories that are interesting: an ostree repo
directory on a directory that was passed to `flatpak create-usb`. By
default the latter has a repo at the subpath ".ostree/repo", and if a
custom destination was specified with "--destination-repo", a symlink is
created pointing to it in ".ostree/repos.d".

Currently Flatpak supports either repos or create-usb dirs in the
`sideload-repos` directory in either the Flatpak installation or
`/run/flatpak` (see flatpak(1)), but only supports repo directories
being passed to "--sideload-repo" for the install and update commands.

This is pretty confusing and actually made me think the sideload support
was broken because I forgot about this limitation. So change things so
we can accept either type of directory specified either way: via option
or via the "sideload-repos" directories.

I've tested all of the following cases:
- pointing to a repo with --sideload-repo
- pointing to a create-usb dir with --sideload-repo
- linking to a repo in ~/.local/share/flatpak/sideload-repos
- linking to a create-usb dir in ~/.local/share/flatpak/sideload-repos
- pulling from a sideload repo when online as a performance improvement
2022-04-11 10:31:13 +02:00
Phaedrus Leeds
65e8572393 po: Update last translater for id.po 2022-04-09 21:33:41 -07:00
Mo 森
4a6da8328f l10n/id: remove an erroneous extra newline 2022-04-07 11:18:47 -07:00
Mo 森
a9cd9b96b4 l10n/id: 'obyek' is not a proper word in Indonesian 2022-04-07 11:18:47 -07:00
Mo 森
5ce7148083 l10n: update Indonesian translation 2022-04-07 11:18:47 -07:00
Phaedrus Leeds
ecafded3b1 dir: Rewrite dynamic launcher entries on deploy
Fixes https://github.com/flatpak/flatpak/issues/4703
2022-03-29 17:24:03 -07:00
Phaedrus Leeds
c3ca2c7010 icon-validator: Fix -Wformat-security warning 2022-03-15 10:27:50 +00:00
Phaedrus Leeds
8b3728addb icon-validator: Add a note on code sharing 2022-03-14 15:09:41 -07:00
Phaedrus Leeds
53267fc287 icon-validator: Print format and size to stdout
Having this patch here rather than in x-d-p means we don't have to carry
downstream changes to the file in x-d-p.

This commit also makes the validator error out if the icon is not
square, since it's simpler to parse one number, and in practice all
icons are square.
2022-03-14 15:09:41 -07:00
Simon McVittie
b6f0045bac Update localization files for release
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.13.2
2022-03-14 16:15:31 +00:00
Simon McVittie
e9915e0b86 Prepare v1.13.2
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-14 15:03:14 +00:00
Simon McVittie
c4f5b7523a NEWS: Update for 1.13.2 so far
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-14 13:30:24 +00:00
Simon McVittie
2df1b1628c dir: Consistently use relative paths for libostree subpaths
The subpath is resolved relative to the root of the commit, so we can
use either an absolute or a relative path interchangeably. When using
libostree < 2021.6 with GLib >= 2.71, absolute paths cause an assertion
failure here; that was a libostree bug and was fixed in 2021.6, but we
can interoperate with more versions by sticking to relative paths, and
there's no real reason to prefer absolute.

Resolves: https://github.com/flatpak/flatpak/issues/4805
Co-authored-by: Corentin Noël <corentin.noel@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-14 13:19:38 +00:00
Simon McVittie
8bf4dbcae9 doc: have-kernel-module-* was added in 1.13.1
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-03 12:34:26 -08:00
Simon McVittie
597abdc585 tests: Don't install tap-driver.sh in the installed-tests
This is specifically for running build-time tests in the Autotools build
system, and is not used when running installed-tests.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-03-03 12:33:37 -08:00
Philip Withnall
9199a8efb6 subprojects: Update variant-schema-compiler to bring in leak fixes
This brings in:
 * https://gitlab.gnome.org/alexl/variant-schema-compiler/-/merge_requests/13
 * https://gitlab.gnome.org/alexl/variant-schema-compiler/-/merge_requests/14
 * https://gitlab.gnome.org/alexl/variant-schema-compiler/-/merge_requests/15

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-03-03 12:32:59 -08:00
Phaedrus Leeds
00c36185bd Update pofiles for release 1.13.1 2022-03-01 13:26:30 -08:00
Phaedrus Leeds
16932e91cf Update NEWS for 1.13.1 2022-03-01 13:26:30 -08:00
Phaedrus Leeds
32b8f75ec4 Update libglnx to fix distcheck 2022-03-01 13:26:30 -08:00
Phaedrus Leeds
7ddd02e440 gitignore: Add libglnx-config.h 2022-03-01 13:26:30 -08:00
Simon McVittie
fc94fb7cd4 Update bubblewrap subproject to v0.6.1
* Add `--add-seccomp` (prerequisite for flatpak/flatpak#4462)
* Add a warning when repeated options are ignored
* Add a Meson build system
* Invoke bash via `PATH`
* Exit early when `argc == 0`

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-27 12:17:04 -08:00
Simon McVittie
fcfd2786ff Update libglnx subproject
* Improve compatibility with eCryptFS (related to #4673)
* Improve compatibility with copying pseudo-files from /proc
* Add a flag to skip fchown() in glnx_file_copy_at()
* Add a rewinddir() wrapper to GLnxDirFdIterator
* Rename its generated config header to libglnx-config.h
* Fix a potential double-free while manipulating xattrs
* Use REUSE for copyright/licensing statements

Note that after merging this in an existing checkout, it will be
necessary to re-run autogen.sh.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-27 12:16:27 -08:00
Phaedrus Leeds
263acc5d24 doc: Try to clarify flatpak-spawn docs 2022-02-24 10:41:02 +00:00
Phaedrus Leeds
759a525771 app: Don't overzealously tab complete options
If the user hasn't typed a '-', don't offer options in the tab
autocompletion. This is consistent with other linux commands, and less
messy.

Fixes https://github.com/flatpak/flatpak/issues/4753
2022-02-21 22:47:16 +00:00
Simon McVittie
0deb80efa8 test-history: Skip test if we cannot read from the Journal
In some OS configurations, unprivileged users cannot read back messages
that they have written to the system log. This test cannot succeed if that
happens, so skip it.

In particular, if the Journal is only in-memory rather than persisted
to disk (as it was by default in Debian 10), then there are no per-user
Journal files, only a single system-wide Journal which requires privileges
to read.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Fixes: 8b05f6b3 "Add a unit test for the history command"
2022-02-20 19:01:33 -06:00
Phaedrus Leeds
af04ea669a dir: Add some precondition checks to repo_pull() 2022-02-20 19:00:50 -06:00
Phaedrus Leeds
11158c2481 dir: Work around libostree partial pull bug
All the details of the bug are in:
https://github.com/ostreedev/ostree/pull/2549
https://github.com/flatpak/flatpak/issues/3479

This patch works around it by marking the commit we're about to pull
partial, so that if the .commit object exists in a staging directory
from a previous failed pull, it will not be erroneously considered a
complete commit, even by affected versions of libostree that don't have
the above patch. If for some reason the commit in the staging dir is
complete, libostree should harmlessly verify that and pull it in.

Usually the commit we are pulling does not already exist in the local
repo, but add a check anyway so we don't risk marking a complete commit
as partial, and so this works on the code path from
"flatpak install --reinstall ..."

Fixes #3479
2022-02-20 19:00:50 -06:00
Phaedrus Leeds
9de49e6dad dir: Fix inaccurate nullable annotation 2022-02-20 19:00:50 -06:00