7367 Commits

Author SHA1 Message Date
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
Hubert Figuière
74df24d8c4 github: add 'needs triage' by default
Signed-off-by: Hubert Figuière <hub@figuiere.net>
2024-02-10 12:06:07 -06:00
Chris Williams
4cb1ca834c info: display extensions found in other installations
Flatpak looks for extensions in all installations, but `flatpak info -e`
would display an error when an extension isn't present in the same
installation as the ref.

Also display the installation name for each extension.
2024-02-06 18:14:42 -06:00
illtellyoulater
897c46f04a
docs: Fix ambiguity due to lack of punctuation & capitalization 2024-02-02 19:38:01 -06:00
Simon McVittie
d5f891e003 Revert "CI: Add mono apt repo to fix build"
We added this entirely unrelated apt repo to make CI work, but in fact
it now makes CI fail.

This reverts commit b6d5e20857b3587c212ce97de78cdbc2ef01d548.
2024-01-25 12:50:57 +00:00
Chris Williams
c4466af059 doc: mention /etc/flatpak/remotes.d in flatpak-flatpakrepo(5) 2024-01-22 09:38:27 -06:00
Chris Williams
40d19dd7b7 doc: fix typo and add cross-references for /etc/flatpak/remotes.d 2024-01-22 09:38:27 -06:00
Alice Mikhaylenko
1a5fd13ca5 dir: Fix glib criticals 2024-01-21 17:33:07 -06:00
Patrick Griffis
8c26798991 update: Make autopruned refs automatically removed
In order to maintain a system over time update automatically removes any EOL runtimes that are unused.

This extends it to also remove any autopruned refs. In practice this means removing no longer used driver versions as the system is updated.

Closes #5261
2024-01-07 18:51:46 -06:00
Dan Nicholson
65bc369a9f tests: Skip more tests when FUSE isn't available
These tests try to install flatpaks, which fails in the system case when
FUSE isn't available to mount revokefs-fuse.
2023-12-08 11:33:12 +00:00
Dan Nicholson
3afdfd298b run: Ignore system bus failures in parental controls check
Currently if the parental controls check can't connect to the system
bus, apps are not allowed to run. However, apps are also allowed to run
if the malcontent (or accounts-service) D-Bus services aren't available.
Since it's trivial to meet that requirement by starting a temporary
dbus-daemon and setting `DBUS_SYSTEM_BUS_ADDRESS` to use it, not being
able to access the system bus at all is no less secure.

This primarily affects flatpak running in a container where D-Bus is
generally not available.

Fixes: #5076
2023-12-08 10:51:30 +00:00
Dan Nicholson
9e58442804 run: Ensure container environment variable is used
If flatpak is run within a container manager that sets the `container`
environment variable, it will override the attempted `flatpak` value.
2023-11-30 13:54:31 -06:00
Philipp Trulson
5248242082 Fix formatting for some German messages 2023-11-23 20:53:32 -06:00
Markus Volk
67cdc0e5a5 meson.build: require native wayland-scanner
This fixes:
| Program /usr/bin/wayland-scanner found: NO
|
| ../git/common/meson.build:123:25: ERROR: Program '/usr/bin/wayland-scanner' not found or not executable
|
| A full log can be found at /home/flk/poky/build/tmp/work/corei7-64-poky-linux/flatpak/1.15.6/build/meson-logs/meson-log.txt
| ERROR: meson failed

At least for the openembedded build environment

Signed-off-by: Markus Volk <f_l_k@t-online.de>
2023-11-20 11:29:15 +00:00
Simon McVittie
27b11b93c2 Update translation files for v1.15.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
1.15.6
2023-11-14 18:55:20 +00:00
Simon McVittie
44ccee2e0c Prepare v1.15.6
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-11-14 18:54:44 +00:00
Simon McVittie
9bf3620aef common: Move locale utils to their own small translation unit
This reduces the size of flatpak-utils and flatpak-dir, which are both
too large.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-11-14 18:39:22 +00:00