Commit Graph

7383 Commits

Author SHA1 Message Date
Simon McVittie
cabafd2e85 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-27 14:16:00 +00:00
Simon McVittie
3477f6ccff Update submodule: xdg-dbus-proxy 0.1.5
* Fix handling of long object paths

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-27 14:14:32 +00:00
Simon McVittie
2a135ac4b3 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-27 13:55:08 +00:00
Simon McVittie
a1bb18561f Update submodule: bubblewrap 0.9.0
* `--symlink` is now idempotent, meaning it succeeds if the
  symlink already exists and already has the desired target
  (containers/bubblewrap#549, flatpak/flatpak#2387,
  flatpak/flatpak#3477, flatpak/flatpak#5255)
* Report a better error message if `mount(2)` fails with `ENOSPC`
  (containers/bubblewrap#615, ValveSoftware/steam-runtime#637)
* Fix a double-close on error reading from `--args`, `--seccomp` or
  `--add-seccomp-fd` argument (containers/bubblewrap#558)
* Improve memory allocation behaviour
  (containers/bubblewrap#556, containers/bubblewrap#624)
* Silence various compiler warnings (containers/bubblewrap#559)

Resolves: flatpak/flatpak#2387
Resolves: flatpak/flatpak#3477
Resolves: flatpak/flatpak#5255
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-27 12:43:40 +00:00
Simon McVittie
3bff0b2b76 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-27 12:08:33 +00:00
Simon McVittie
f9cbfe1fd6 flatpak-prune: Make sure to calculate hash in the unsigned domain
Otherwise, an out-of-bounds left shift can occur, as diagnosed by
UBSan here:

    ../../../../src/flatpak/common/flatpak-prune.c:387:14: runtime error: left shift of 253 by 24 places cannot be represented in type 'int'

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-21 20:20:29 +00:00
Simon McVittie
2fc71b1f80 Fix missing declaration for g_fdwalk_set_cloexec() with GLib 2.80.x
With older GLib, it's provided by libglnx, but with newer GLib, we need
to include the correct header.

Fixes: 7b1cd206 "Replace flatpak_close_fds_workaround() with g_fdwalk_set_cloexec()"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-21 20:20:15 +00:00
Sebastian Wick
9532c8d333 dir: Reload DBus daemon config to ensure services get picked up
This is best effort. There is a 2s timeout and if something fails
everything continues on.

This is called from flatpak_dir_run_triggers because it gets called
whenever we might have changes to the exported service files.

Fixes #3342

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
2024-03-20 20:08:58 +00:00
Hubert Figuière
56438bf542 doc: Fix multiple validation errors in docbook.
Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-03-20 19:43:49 +00:00
Chris Williams
cf76cb61ba ps: Add gnome to background portal backend list
This is used for the active and background columns.
2024-03-20 19:42:33 +00:00
Simon McVittie
ef2c66b900 Update NEWS
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-20 18:56:19 +00:00
Chris Williams
955d0c091a profile: Unset temporary variable
Fixes: #5574
2024-03-15 13:32:48 -05:00
Simon McVittie
26f740f67b Update NEWS with changes to date
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-03-15 18:23:54 +00:00
Chris Williams
886462b811 tests: Check appdata name parsing via flatpak info
Add a basic test for the extraction of appdata name and summary values
that are displayed in the flatpak UI. Also use the new developer name
syntax in the test app. This tests the fix made in previous commit.
2024-03-12 08:31:08 -05:00
Chris Williams
73d4a3b062 appdata: exclude <name> element inside <developer>
<developer_name> has been deprecated in favor of <developer> with a
<name> child. We need to ensure that this developer name isn't parsed
as the application name.

Fixes: #5700
2024-03-12 08:31:08 -05:00
Pablo Correa Gómez
2cb17b4eb8 Do not hard-code fusermount, add option or auto-detect instead
The hard-coding is not appropriate. According to libfuse 3.0.0 release
notes: "The fusermount and mount.fuse binaries have been renamed to
fusermount3 and mount.fuse3 to allow co-installation of libfuse 2.x
and 3.x". Some distributions seem to install a symlink, but this is
not upstream's default behavior.

In addition, fusermount might be provided from non-distro sources. So
a build-time option takes precedence over auto-detection logic.

Fixes #5104

Fixes #5694
2024-02-19 12:05:05 +00:00
Simon McVittie
8e63eda867 Remove Autotools build system
As discussed in #5695, I think we're reaching a point where removing
Autotools is preferable to fixing it.

1.14.x continues to use Autotools, so platforms whose Meson version is
too old can stay on that branch until it becomes unsupported. We have
a very conservative Meson dependency (Ubuntu 20.04).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Simon McVittie
a9ad688d03 workflows: Exclusively build using Meson
Enabler for removing the Autotools build system.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Simon McVittie
fe09a3437b workflows: Tidy up coding style of pre-existing Meson invocations
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Simon McVittie
5114df1fcb workflows: Remove confusing relic from Ubuntu 18.04
Before commits 97768cea and cb655ab3, we were upgrading GLib to a
post-Ubuntu-18.04 version before running tests, to work around a GLib
bug. We no longer need to do that now that we're running everything on
Ubuntu 20.04 or later.

Fixes: cb655ab3 "check.yml: remove glib260 ppa"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-16 19:30:32 +00:00
Philip Withnall
7268ff628e common: Fix use of deprecated libmalcontent symbols
These symbols were soft-renamed in libmalcontent 0.5.0 (released in
February 2020). We can probably now safely depend on that, and use the
renamed versions.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-02-15 20:44:53 +00:00
Simon McVittie
4b159b11eb httpcache: Free the GError before exiting
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
dfe995a457 testlibrary: Don't leak list of subpaths
flatpak_deploy_data_get_subpaths() returns a new array (of unowned
strings) and flatpak_dir_new_deploy_data() doesn't take ownership.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
955e9ceed3 test_list_remote_related_refs: Don't leak list of subpaths
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
7dc71e1fed testlibrary: Don't leak strings retrieved from remote
All of these getters are (transfer full) (but note that
flatpak_remote_get_name() isn't).

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
6636592d2d testlibrary: Don't leak an array of related refs
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
88a919a32e testlibrary: Don't leak icon data 2024-02-15 20:33:06 +00:00
Simon McVittie
5cd581d0ae testlibrary: Don't leak FlatpakInstance
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
843eca7958 testlibrary: Don't leak several installed references
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
3cf98a3118 testlibrary: Don't leak transactions
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Simon McVittie
80c1fc5f78 tests: Fix a double-free when exercising argument parsing
g_option_context_add_group() takes ownership of the group that it's
given, so we can't also free it.

Fixes: fab0f8ed "test-context: Exercise some corner cases for merging filesystems"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 20:33:06 +00:00
Chris Williams
ac4b51e3aa doc: rename man pages to flatpakref(5) and flatpakrepo(5)
Add symlinks to preserve flatpak-prefixed names.

Also fix section reference in flatpak-install(1).
2024-02-15 11:41:56 -06:00
Simon McVittie
7b1cd20696 Replace flatpak_close_fds_workaround() with g_fdwalk_set_cloexec()
flatpak_close_fds_workaround() wasn't technically async-signal-safe,
because the requirement for sysconf() to be async-signal-safe was
removed in POSIX.1-2008.

It could also leave high fds open in some cases: in practice
sysconf(_SC_OPEN_MAX) returns the soft resource limit, but if our
resource limit has been reduced by an ancestor process, we could
conceivably still have fds open and inherited above that number.

We can fix this by using g_fdwalk_set_cloexec() with GLib >= 2.79.2,
or the backport in libglnx with older GLib. This uses close_range()
if possible, falling back to rummaging in /proc with async-signal-safe
syscalls.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 16:06:41 +00:00
Simon McVittie
2a363d7569 build: Consistently put libglnx.la last in lists of dependencies
It needs to be able to satisfy dependencies of higher-level Flatpak
static libraries.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 16:06:41 +00:00
Simon McVittie
a607246519 system-helper: Don't leak the GCancellable for each OngoingPull
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
ec796ec37f flatpak-bwrap: Don't leak runtime_dir_members
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
14846313f9 flatpak_remote_commit_filter: Don't leak config GKeyFile
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
7663b5137f session-helper: Don't leak the GOptionContext
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
a96834bb32 populate_commit_data_cache: Don't leak a floating GVariant
var_variant_dup_to_gvariant() returns a floating GVariant, and
g_variant_get_child_value() won't sink it, so we need to free it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
fd56fb85f8 populate_commit_data_cache: Don't leak child value
g_variant_get_child_value() returns a non-floating reference, so
g_variant_builder_add() will not sink it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
b97704dee6 dir: Don't store a pointer in a gsize
This is, strictly speaking, not allowed. On uncommon architectures like
CHERI, a pointer can be larger than a gsize.

This might also help to avoid AddressSanitizer losing track of
reachability, so that it won't think the array and its contents have
been leaked.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
2350ef1111 main: Return from flatpak_run() instead of calling exit()
This allows g_autoptr destructors to run, avoiding memory leaks being
reported by AddressSanitizer; they would be harmless, since we're about
to exit anyway, but AddressSanitizer can't tell the difference between
an O(n) problem and an O(1) harmless "leak".

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Simon McVittie
07ad6af5ac main: Use g_autoptr for the GOptionContext
No functional change, but it will make it easier to avoid leaking it.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-15 11:06:30 +00:00
Markus Volk
28c08413dc meson.build: require native gtkdoc
this fixes:
| Run-time dependency gtk-doc found: NO (tried pkgconfig)
|
| ../git/meson.build:206:13: ERROR: Dependency "gtk-doc" not found, tried pkgconfig

Signed-off-by: Markus Volk <f_l_k@t-online.de>
2024-02-14 19:40:46 +00:00
Weng Xuetian
0402e1614c Limit the usage of WAYLAND_SOCKET to an opt-in feature
1. For security context creation, only relies on WAYLAND_DISPLAY, do not
   use WAYLAND_SOCKET since the file descriptor defined by WAYLAND_SOCKET
   can be only consumed once.
2. Due to the incompatiblity between WAYLAND_SOCKET and the security
   context, add a new permission --socket=inherit-wayland-socket
   to limit the usage of WAYLAND_SOCKET to an opt-in feature. Only when
   this flag is set, WAYLAND_SOCKET will be passed to the sandbox.
3. When WAYLAND_SOCKET is not inherited, set FD_CLOEXEC to avoid it to
   be leaked the to sandbox.

Closes: #5614
2024-02-14 19:39:50 +00:00
Hubert Figuière
6e3cc82af3 Fix memory leaks
Build with address sanitizer and run the tests

Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-02-13 08:20:57 -06:00
Simon McVittie
8eee4bd452 Update submodule: libglnx 2024-02-09
* Provide fallback syscall wrapper for close_range()
* Backport g_closefrom() from GLib 2.79.2
* Backport g_fdwalk_set_cloexec() from Glib 2.79.2
* glnx_lsetxattrat(): Fix incorrect path argument
* Fix running `meson test` without first running `meson compile`
* Replace defunct mailing list with support forum

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 14:19:28 +00:00
Simon McVittie
3a297d8e1d test-run.sh: Assert that fd redirections pass through into the app
Before the previous commit, this would normally work, but would fail if
we had FLATPAK_TEST_COVERAGE=1 in the environment.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 13:48:38 +00:00
Simon McVittie
48caf88a63 Always allow app to inherit redirected fds from flatpak-run(1)
As noticed on #5615, under normal circumstances, flatpak-run(1)
replaces itself with the bwrap process via execve(), and does not
close any fds that it might have inherited from its parent. This
allows for patterns like:

    flatpak run com.example.App --in-fd=3 --out-fd=5 3<foo 5>bar

However, using execve() is annoying when trying to analyze code
coverage, because the coverage instrumentation does not get the
opportunity to write out its data during exit, so it is possible to
set FLATPAK_TEST_COVERAGE=1 to make flatpak run the app as a child
process and wait for it. This puts us on the code path normally used
for apps launched in the background by flatpak_installation_launch_full(),
which *don't* inherit arbitrary fds from their parent.

Detect this situation and use a different child setup function,
avoiding closing fds that we were meant to inherit.

Fixes: 88a928ea "run: Avoid execve() when measuring test coverage"
Signed-off-by: Simon McVittie <smcv@collabora.com>
2024-02-13 13:48:38 +00:00
Hubert Figuière
2dd73bc343 doc: Add since version for --device=input
Follow-up to #5481

Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-02-11 10:19:45 -06:00