Commit Graph

6962 Commits

Author SHA1 Message Date
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
Phaedrus Leeds
86254d5931 Cache result of flatpak_fancy_output()
There might be performance issues with doing this many times, so cache
the result.
2022-02-20 18:26:13 -06:00
Phaedrus Leeds
784bc5566d Disable fancy output when G_MESSAGES_DEBUG is set
Just as we already call flatpak_disable_fancy_output() in
flatpak_option_context_parse() in case verbose output is enabled via CLI
options, disable fancy output in case verbose output was enabled via the
G_MESSAGES_DEBUG env var. Without this change, the result of doing e.g.
$ G_MESSAGES_DEBUG=OSTree flatpak install ...
is pretty useless and ugly, when the output isn't being redirected to a
file, since the debug messages are overwritten when we redraw to show
progress updates.

This makes the output of "flatpak list" a bit ugly when G_MESSAGES_DEBUG
is set, but it seems like a small price to pay.
2022-02-20 18:26:13 -06:00
Phaedrus Leeds
12ebf8fd9a Delete some unreachable ref-not-found code
flatpak_remote_state_lookup_ref() always sets the error to
FLATPAK_ERROR_REF_NOT_FOUND when it returns FALSE.

Found by coverity CID 1514265
2022-02-19 15:32:34 +00:00
Simon McVittie
2e5dd255e8 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-02-19 14:27:49 +00:00
Phaedrus Leeds
bf3cedc9be NEWS: Remove an inaccurate entry for 1.13.1
Disallowing "sudo flatpak run ..." is not a recent change.
2022-02-18 15:03:38 -06:00
Phaedrus Leeds
c932a57f4f doc: Tweak a few man pages
Make it clear what the current behavior is for sideloading from local
sources as well as for uninstalling unused EOL runtimes.
2022-02-17 10:37:25 -06:00
Phaedrus Leeds
6dc067ca33 search: Improve memory efficiency 2022-02-17 08:29:20 -06:00
Phaedrus Leeds
af11e25975 search: Properly get branch values 2022-02-17 08:29:20 -06:00
Phaedrus Leeds
5d9d03d875 tests: test search command
This is basically what we already have in test-oci-registry.sh but for
the non-OCI case.
2022-02-17 08:29:20 -06:00
Phaedrus Leeds
2af0c17297 search: Fix printing app ID with no .desktop suffix
In https://github.com/flatpak/flatpak/issues/4535 it was brough to light
that the search command strips the ".desktop" suffix from app IDs even
if they genuinely end in .desktop. This commit fixes the reverse issue
now that we've ported to libappstream: don't include the .desktop suffix
even if it's present in the id of the appstream component, which it
sometimes is.

Fortunately we already ignore any components that don't have flatpak
<bundle> elements, so we can unambiguously get the ID there.

Fixes #4535
2022-02-17 08:29:20 -06:00