Commit Graph

7190 Commits

Author SHA1 Message Date
Simon McVittie
be2de97e86 dir: If metadata is syntactically invalid, say which file is the problem
Similar to the previous commit, but for metadata.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 21:14:17 +00:00
Simon McVittie
3ede5382fa dir: If overrides are syntactically invalid, include path in error message
It's unhelpful to say something like "Key file contains line “x” which is
not a key-value pair, group, or comment" without specifying which file
we are talking about.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 21:14:17 +00:00
Simon McVittie
628750d2de list: Show a warning if we can't load the current version
Conceptually similar to the previous commit, except it didn't crash
before, just didn't display anything.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 21:14:17 +00:00
Simon McVittie
5e2e771ece list: Handle error in flatpak_dir_load_deployed()
flatpak_dir_load_deployed() can fail and return NULL. If that happens,
there is a semi-installed but broken app, and we should show a warning
rather than crashing.

Resolves: https://github.com/flatpak/flatpak/issues/5293
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 21:14:17 +00:00
Simon McVittie
5b2295508f Update NEWS
[skip ci]

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-08 12:13:34 +00:00
Simon McVittie
c1d0b46cd4 utils-http: Avoid deprecation warning with curl >= 7.85.0
CURLOPT_PROTOCOLS_STR is documented as the replacement for
CURLOPT_PROTOCOLS.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-07 14:04:01 +00:00
Simon McVittie
64d627968e run: Avoid double-free of gpgconf stdout stream
g_subprocess_get_stdout_pipe() does not transfer ownership, so the
stream still belongs to the GSubprocess and we must not unref it.

Fixes: 764e5a4d "Add --socket=gpg-agent"
Resolves: https://github.com/flatpak/flatpak/issues/5095
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-07 14:03:47 +00:00
Phaedrus Leeds
b13d387aef dir: Add more debug output for unused refs
Inspired by the slight mystery of
https://github.com/flatpak/flatpak/issues/5192, this commit adds more
debug output to the functions that analyze installations for unused
refs. Some of the output is g_debug() (enabled by -vv) and some is
g_info() (enabled by -v) since otherwise the output would be too
verbose. This should hopefully help debug problems, not only related to
the unused refs code but anything involving dependencies.
2023-02-06 16:19:50 +00:00
Juan
b628f3f19d Spanish translation update 2023-02-06 16:17:59 +00:00
Simon McVittie
a98bbbe2ce Update translation files for 1.15.2 release
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.15.2
2023-02-06 14:07:32 +00:00
Simon McVittie
4b261f53ed Prepare v1.15.2
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-02-06 12:04:31 +00:00
Piotr Drąg
fa35ebe513 Update POTFILES.in 2023-02-05 12:08:23 -06:00
Patrick Griffis
bb730ef8b8 Revert "Add support for files generated by appstreamcli compose (#5277)"
This reverts commit 88f7ecd000.
2023-02-04 12:30:15 -06:00
Luna
88f7ecd000 Add support for files generated by appstreamcli compose (#5277)
Co-authored-by: Bartłomiej Piotrowski <b@bpiotrowski.pl>
Co-authored-by: Jamie Murphy <hello@itsjamie.dev>
2023-02-04 10:40:07 -06:00
Simon McVittie
e72ae11b93 NEWS: Update
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-30 10:22:19 +00:00
Forest
01910ad12f utils: Unmap the old summary.idx file before trying to replace it
Exporting to an existing repo on a Samba filesystem failed with EACCES
when libglnx called renameat() to replace the old summary.idx file.

    error: renameat: Permission denied

This occurred even when the user had appropriate permissions to the file
and its ancestor directories. The problem was that flatpak had mapped the
old file into memory for reading, and still held a reference to that mapping
when attempting to replace the underlying file. Apparently this works on some
filesystems, but not on cifs.

We therefore release the memory mapping before replacing the underlying file.

Fixes #5257

Co-authored-by: Patrick <tingping@tingping.se>
2023-01-22 19:21:36 -06:00
Dmitry
16be436de3 Russian translation update (#5262) 2023-01-22 10:13:55 -06:00
Dmitry
a9a2c70e96 Russian traslation updated (#5256) 2023-01-15 12:27:40 -06:00
Simon McVittie
0aa0284c10 exports: Test that a symlink to the root directory is rejected
Reproduces: https://github.com/flatpak/flatpak/issues/1357
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
fe49f8f7ca exports: Assert that recently-excluded paths are excluded
Reproduces: https://github.com/flatpak/flatpak/issues/5205
Reproduces: https://github.com/flatpak/flatpak/issues/5207
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
e3507918c0 exports: Don't export parent or ancestor of reserved directories
Previously, --filesystem=/run would prevent apps from starting by
breaking our ability to set up /run/flatpak and /run/host. Now it is
ignored, with a diagnostic message, resolving #5205 and #5207.

Similarly, --filesystem=/symlink-to-root (or --filesystem=host) would
have prevented apps from starting if a symlink like
`/symlink-to-root -> /` or `/symlink-to-root -> .` exists, and refusing
to export the target of that symlink avoids that failure mode,
resolving #1357.

Resolves: https://github.com/flatpak/flatpak/issues/1357
Resolves: https://github.com/flatpak/flatpak/issues/5205
Resolves: https://github.com/flatpak/flatpak/issues/5207
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
a747e2c0c4 context: Show a warning if we cannot provide any $HOME
If $HOME is below a reserved path (for example `/usr/home/thompson`
for Unix traditionalists) or otherwise cannot be shared, or is a
symbolic link to somewhere that cannot be shared, then we will end
up running the app with $HOME not existing. This is unexpected, so
we should make more noise about it.

There are two situations here, both of which get a warning: if we have
--filesystem=home or --filesystem=host then we are trying to share the
real $HOME with the application, and if we do not, then we are trying
to create a directory at the location of the real $HOME and replicate
the chain of symlinks (if any) leading from $HOME to that location.

Unlike the previous commit, this is not expected to happen during unit
testing, so we do not use a g_warning() for this.

Diagnoses: https://github.com/flatpak/flatpak/issues/5035
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
eebee9eb0f context: Show a warning when --filesystem exists but can't be shared
If the user gives us a override or command-line argument that we cannot
obey, like --filesystem=/usr/share/whatever or
--filesystem=/run/flatpak/whatever, then it's confusing that we silently
ignore it. We should give them an opportunity to see that their override
was ineffective.

However, there are a few situations where we still want to keep quiet.
If there is a --filesystem argument for something that simply doesn't
exist, we don't diagnose the failure to share it: that avoids creating
unnecessary noise for apps that opportunistically share locations that
might or might not exist, like the way the Steam app on Flathub asks
for access to $XDG_RUNTIME_DIR/app/com.discordapp.Discord.

Similarly, if we have been asked for --filesystem=host, the root
directory is very likely to contain symlinks into a reserved path, like
/lib -> usr/lib. We don't need a user-visible warning for that.

We actually use the equivalent of g_message() rather than g_warning(),
to avoid this being fatal during unit testing (in particular when we
do a `flatpak info` on an app that has never been run, which will
be unable to share its `.var/app` subdirectory). `app/flatpak-main.c`
currently displays them as equivalent to each other anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
073bdccd9e exports: Move error handling up into caller
This lets flatpak_context_export() or other callers decide how they want
to handle failure to export each path. For now, the callers in
FlatpakExports are still using g_debug() unconditionally, but we can now
have somewhat better test coverage.

Helps: https://github.com/flatpak/flatpak/issues/1357
Helps: https://github.com/flatpak/flatpak/issues/5035
Helps: https://github.com/flatpak/flatpak/issues/5205
Helps: https://github.com/flatpak/flatpak/issues/5207
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
6394e7f77c exports: Make _exports_path_expose produce a GError on failure
This is a step towards allowing its direct and indirect callers to decide
how serious the failure is, and debug or warn accordingly.

Helps: https://github.com/flatpak/flatpak/issues/5205
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
ff1f8fc1fa exports: Never try to export /.flatpak-info
Just for completeness, in practice the host system will not have this.

Helps: https://github.com/flatpak/flatpak/issues/5205
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
6a783cfcf2 exports: Never try to export paths below /run/flatpak or /run/host
These directories are reserved for Flatpak's own use.

Helps: https://github.com/flatpak/flatpak/issues/5205
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Simon McVittie
bfafbc1f92 exports, context: List unexported paths one per line in sorted order
This will reduce conflicts when new entries are added.

Helps: https://github.com/flatpak/flatpak/issues/5205
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-01-12 15:13:34 +00:00
Phaedrus Leeds
523cedc275 trivial: Trim some long lines, etc. 2023-01-02 20:45:19 -06:00
Phaedrus Leeds
8ca1604a94 repair: Fix off-by-one error in fancy output
Fixes https://github.com/flatpak/flatpak/issues/5204
2023-01-02 20:45:19 -06:00
Sabri Ünal
1e8cb14281 Update Turkish translation 2022-12-31 18:12:10 -06:00
Simon McVittie
7a99c82900 dir: Use consistent FlatpakRunFlags everywhere
In principle either of these functions might read any of the flags.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-19 19:15:23 +00:00
Simon McVittie
e69afb1986 portal: Factor out flatpak_bwrap_is_unprivileged()
We can use this for other features that rely on having a non-setuid
version of bubblewrap.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-19 19:15:23 +00:00
Simon McVittie
60e2cceb8c common: Replace all flatpak_debug2() with g_debug()
They are now equivalent.

Resolves: https://github.com/flatpak/flatpak/issues/5001
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Simon McVittie
c2c034733e common: Make flatpak_debug2() use the same domain as g_debug()
Now that we are logging `flatpak -v` messages with log level INFO,
and printing INFO messages in the same way as DEBUG, we can reserve
log level DEBUG for `flatpak -v -v` messages. This means we no longer
need a weird secondary debug domain.

There is a very small behaviour change here: G_MESSAGES_DEBUG=flatpak
is now similar to `flatpak -v -v` (previously `flatpak -v`), and
G_MESSAGES_DEBUG=flatpak2 no longer has any effect. This seems more in
line with what would be expected from a GLib-based application.

In flatpak(1) and the system helper, this does not change behaviour
other than that: the same messages are logged by `-v` and by `-v -v`
as before.

In daemons that do not implement `-v -v` (the OCI authenticator, portal
and session helper), it continues to be necessary to use
G_MESSAGES_DEBUG to see flatpak_debug2() messages.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Simon McVittie
86c9d7d4c7 daemons, etc.: Use g_info() for messages that are enabled by -v
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Simon McVittie
522a933bc9 app: Use g_info() for messages that will be shown by flatpak -v
This brings us one step closer to being able to stop using the flatpak2
log domain for messages that are exclusive to `flatpak -v -v`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Simon McVittie
07a6541f06 common: Use g_info() for messages that will be shown by flatpak -v
This brings us one step closer to being able to stop using the flatpak2
log domain for messages that are exclusive to `flatpak -v -v`.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-15 16:45:35 +00:00
Simon McVittie
ea584acf20 daemons: Treat g_info() as equivalent to g_debug()
Same as the previous commit, but for anything that runs in the
background.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-14 20:02:35 +00:00
Simon McVittie
ac4e322629 main: Treat g_info() as equivalent to g_debug()
This makes us consistent with the default behaviour of GLib, and
its behaviour with G_MESSAGES_DEBUG=all. g_debug() and g_info() are
the two lowest priority levels, and GLib normally silences them by
default.

At the moment, Flatpak uses G_LOG_LEVEL_DEBUG in the flatpak2 domain
as its lowest-priority log level (only shown with flatpak -v -v), and
G_LOG_LEVEL_DEBUG in the flatpak domain as its second-lowest
(shown with flatpak -v or higher). I want to move towards using
G_LOG_LEVEL_INFO for flatpak -v messages, and G_LOG_LEVEL_DEBUG for
flapak -v -v, so that we don't need a second log domain: this is a
policy I've used successfully in Flatpak-derived Steam Runtime code.

This change does not fully implement that policy, but gives us a
migration path towards it, by allowing us to start using g_info() for
flatpak -v messages.

Helps: https://github.com/flatpak/flatpak/issues/5001
Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-14 20:02:35 +00:00
David King
87c9fccdb2 selinux: Install to previous location
Install flatpak.if to the same location for Autotools and meson.
2022-12-14 20:00:48 +00:00
David King
13c5326122 selinux: Install when using meson
With custom_target, providing build_by_default is not enough to install
the output, which must be explicitly requested.
2022-12-14 20:00:48 +00:00
Simon McVittie
f3c79b2974 Update submodule: bubblewrap 0.7.0
- Better error messages on various failure modes

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-12 19:16:22 +00:00
Simon McVittie
1eed25617c Replace calls to g_memdup() with g_memdup2()
g_memdup() is subject to an integer overflow on 64-bit machines if the
object being copied is larger than UINT_MAX bytes. I suspect none of
these objects can actually be that large in practice, but it's easier
to replace all the calls than it is to assess whether we need to
replace them.

A backport in libglnx is used on systems where GLib is older than 2.68.x.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-12 19:15:52 +00:00
Simon McVittie
7a144248f2 Update submodule: libglnx
- Backport g_memdup2

Signed-off-by: Simon McVittie <smcv@collabora.com>
2022-12-12 19:15:52 +00:00
Leorize
df0b9d98b5 flatpak-run: unset GIO_EXTRA_MODULES
This variable contains paths to load GIO modules from. For the most
part, they refer to paths outside of the sandbox or if they happen
to be in the sandbox, would contain modules that are incompatible with
the sandbox runtime (ie. different libc).

While I've not found programs that would crash outright, it may cause
unexpected behaviors (eg. Apostrophe not being able to render math in
preview panel).

This variable is set by NixOS for its dependency boxing.
2022-12-07 16:20:51 -06:00
Patrick
8daa975ab3 CI: Disable Valgrind test for now
This test has consistently failed for months as it takes too long.

While it should be looked into its not helpful to show CI as always failing either.
2022-12-05 14:33:51 +00:00
Martin Kühl
16707a1937 profile.d: Only add new directories to XDG_DATA_DIRS in fish
Previously in a0505f52d9
the profile script was modified to preserve XDG_DATA_DIRS.
This had the side-effect of making the script not idempotent,
adding duplicate entries for every installation every time it's sourced.

On my current system  that results in this value:

    /home/mkhl/.local/share/flatpak/exports/share /var/lib/flatpak/exports/share /home/mkhl/.local/share/flatpak/exports/share /var/lib/flatpak/exports/share /usr/local/share /usr/share

which in turn has the side-effect of the GNOME search settings showing two entries
for every application installed via flatpak.

This change makes the script check that an entry is new before adding it.
It also uses `set -p` (short for `--prepend`) to add them.

N.B.
`set -p VAR val` is equivalent to `set VAR val $VAR`
`$var[-1..1]` reverses the order of elements
so after iterating the first element of `$installations`
becomes the first element of `$XDG_DATA_DIRS`
2022-12-04 11:43:30 -06:00
Leorize
751ff11d3a flatpak-run: unset XKB_CONFIG_ROOT
This variable is typically used to configure the use of a custom
set of XKB definitions. In those cases, it's mostly meant for the
X11 server or Wayland compositor. NixOS is known to employ this
variable for their custom XKB layout implementation.

When the path it points to is unreachable (due to the sandbox),
most GTK+/Qt applications will crash on Wayland.

Unsetting this does not seem to negatively impact the use of custom
XKB layouts with Flatpak applications.
2022-12-01 20:01:14 -06:00
Jan Macku
668fc7d514 ci(lint): add shell linter - Differential ShellCheck
It performs differential ShellCheck scans and report results directly in pull request.

documentation: https://github.com/redhat-plumbers-in-action/differential-shellcheck

Signed-off-by: Jan Macku <jamacku@redhat.com>
2022-11-22 10:58:52 -06:00