8467 Commits

Author SHA1 Message Date
Mia McMahill
8c418fa4b9 flatpak-coredumpctl: Use subprocess.PIPE instead of NamedTemporaryFile 2026-05-27 14:48:22 +00:00
Mia McMahill
61272df8cd flatpak-coredumpctl: Require Python 3.10 or greater at runtime 2026-05-27 14:48:22 +00:00
Mia McMahill
b6ceab85c3 flatpak-coredumpctl: Pass tuple to startswith instead of two calls 2026-05-27 14:48:22 +00:00
Mia McMahill
4bcd6cd48b flatpak-coredumpctl: Pass description as argparse description argument
This prevents it from getting printed twice in some circumstances
2026-05-27 14:48:22 +00:00
Mia McMahill
8e5d4c1183 flatpak-coredumpctl: Exit with return code of flatpak_command 2026-05-27 14:48:22 +00:00
Mia McMahill
0285e879d0 flatpak-coredumpctl: Print help message to stderr
This is more consistent with common practice for
help messages printed due to missing/incorrect arguments.
2026-05-27 14:48:22 +00:00
Mia McMahill
d7dbb10845 flatpak-coredumpctl: Replace old style format strings with f-strings
Print out error messages instead of raising an uncaught exception

Replace one more set of quotes that I missed previously
2026-05-27 14:48:22 +00:00
Mia McMahill
f48c7866b6 flatpak-coredumpctl: Clean up mixed usage of single and double quotes 2026-05-27 14:48:22 +00:00
Mia McMahill
af453ce99d flatpak-coredumpctl: Check for /app as well as /newroot
This fixes a bug where the warning about not being a flatpaked
application was being printed for flatpaks. This was due to a
change in bwrap so that the paths no longer start with /newroot.
2026-05-27 14:48:22 +00:00
Jordan Petridis
9a813ffba0 dir: Ignore system bus failures in parental controls check
Being unable to access the system-bus is nto a security boundry since,
in that case it's trivial to start your own session and set
DBUS_SYSTEM_BUS_ADDRESS. This is the same fix as 3afdfd2 but for handling
installation instead. See said commit for more details.

Adapted from #5609
Fixes #5076

Co-authored-by: Dan Nicholson <dbn@endlessaccess.org>
2026-05-27 14:39:32 +00:00
razzeee
8fd0f5d706 run: Add /dev/kfd to dri device permission
/dev/kfd is used for AMD ROCm/OpenCL compute. Add it to the dri
device list so apps can request GPU compute access without
needing --device=all.

Fixes: https://github.com/flatpak/flatpak/issues/5383
2026-05-27 14:36:25 +00:00
qweered
3891a228c6 profile: Skip flatpak --installations for fish if already in XDG_DATA_DIRS
Sourcing profile/flatpak.fish spawns `flatpak --installations` on every
fish shell startup, which costs ~15 ms on a typical desktop and
dominates fish's non-interactive init time when flatpak is installed.

On any system where the login stack (pam_env, systemd user session,
distro-specific init) has already populated XDG_DATA_DIRS with the
canonical user flatpak export path, this spawn is redundant: the
subsequent `contains` loop would be a no-op because the canonical
entry is already there.

Add a fast-path guard that checks for `$XDG_DATA_HOME/flatpak/exports/share`
(falling back to `$HOME/.local/share/flatpak/exports/share` when
XDG_DATA_HOME is unset) at the top of the script. When present, skip
the slow path entirely.

The slow path is preserved verbatim for sessions where the canonical
entry is missing — e.g. a freshly-created user, or environments where
session init hasn't populated XDG_DATA_DIRS yet — so custom
installations configured via /etc/flatpak/installations.d/*.conf are
still discovered in that case.

Measured on Linux with `hyperfine --warmup 5 'fish -c exit'`:
  before: ~23 ms of startup spent in `flatpak --installations`
  after:  ~10 us (a single `contains` check) on the common path.
2026-05-27 14:34:21 +00:00
bbhtt
a38377eb88 tests: Suppress an unused-result warning
The warning seems to happen with GCC 11 but not with GCC 13 or newer.

A simple void cast still leaves the warning enabled due to a bug
or intentional choice in GCC [1], so it is assigned to a variable first
and then void-ed.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
2026-05-27 14:32:40 +00:00
lumingzh
da20e502d9 update Chinese translation 2026-05-27 14:30:28 +00:00
Ryan Gonzalez
588eef8e65 dir: Include found refs in "ref binding metadata" errors
I accidentally screwed up the arch I passed to a `flatpak update`
invocation and was very confused as to what actually went wrong. Adding
the actual refs in the commit should help make failure cause more
obvious.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2026-05-13 02:44:17 +00:00
razzeee
7b17f13e5d http: Replace deprecated GTimeVal with g_get_real_time()
GTimeVal and g_get_current_time() are deprecated since GLib 2.62
and tv_sec is 32-bit on 32-bit platforms, causing Y2038 overflow.
g_get_real_time() returns gint64 and is safe on all platforms.
2026-05-13 01:08:29 +00:00
razzeee
cc727e7f09 dir/http: Use gint64 for g_ascii_strtoll return values
g_ascii_strtoll returns gint64; storing the result in a narrower
type (int, gint) silently truncates large values.
2026-05-13 01:08:29 +00:00
razzeee
250516b059 history: Use uid_t and g_ascii_strtoull for UID parsing
UIDs are unsigned; using signed strtoll and int can mishandle
high UIDs such as those used by systemd dynamic users.
2026-05-13 01:08:29 +00:00
Rudi Heitbaum
68ffa487ee dir: fix build when HAVE_LIBSYSTEMD but not USE_SYSTEM_HELPER
polkit_subject_to_string() is called inside the HAVE_LIBSYSTEMD guard
in flatpak_dir_log(), but <polkit/polkit.h> is only included when
USE_SYSTEM_HELPER is defined. This causes a build failure on
configurations that have libsystemd but no system helper.

Guard the polkit call with USE_SYSTEM_HELPER and fall back to "(none)"
so the subject string is always valid for the sd_journal_send() call.

Fixes: f9d5c5c ("dir: Free result of polkit_subject_to_string")
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-05-09 18:56:16 +05:30
Sebastian Wick
3daccaeadc Post-branching version bump 2026-05-06 00:51:17 +02:00
Sebastian Wick
b4c53a4cff 1.17.7 1.17.7 2026-05-06 00:48:51 +02:00
Sebastian Wick
8d58ebdeb4 Update translation files for 1.17.7 2026-05-06 00:43:28 +02:00
Sebastian Wick
17cb1135cb context: Keep fallback-x11 separate from x11 conditionals
If we convert fallback-x11 internally to a conditional x11 permission,
we cannot express current fallback-x11 stacking behavior:

lower: empty + upper: !fallback-x11 -> no x11 access
lower: fallback-x11 + upper: !fallback-x11 -> x11 access

The reason is that conditionals have no view of the lower level.

This changes things in a way that fallback-x11 stays its own socket
permission with two interactions with the x11 socket permission:

* If a upper level resets x11 (--socket=x11, --nosocket=x11), the lower
  level fallback-x11 permission gets dropped
* When computing the allowed sockets, --socket=fallback-x11 gets
  converted to --socket=if:x11:!has-wayland

Fixes: #6556
2026-04-29 10:14:29 +00:00
Sebastian Wick
bd75302323 tests/repo: Make a test more robust by checking files for diff
Instead of trying to read them into variables, which could fail if there
were null bytes in the key.

Fixes: 43642337 ("dir: Try to delete the remote if we failed to add it entirely")
2026-04-28 13:18:48 +00:00
Sebastian Wick
3296c9e619 system-helper: Fix checking if the reinstall flag was passed in
Fixes: 919d2922 ("common: support reinstall option on bundle installations")
2026-04-28 13:18:48 +00:00
Sebastian Wick
68343e938f tests: Fix checks where we expect a command to fail
I was convinced that the pattern `! command` with -e aborts when
`command` fails. This is not the case (the result of `false` is the same
as `! true` but somehow this doesn't matter).

Fix the tests and use the newly introduced `assert_not` function. One
could also use `command && assert_not_reached "message"` but who has
time to write error messages for all the cases.
2026-04-28 13:18:48 +00:00
razzeee
6dfe1ad4d0 dir: handle missing remote tracking ref in repo_pull so that Flatpak-Upgrade-From header is sent 2026-04-21 11:28:31 +00:00
razzeee
fad37dfa8c tests: add test for Flatpak-Upgrade-From header on install vs update
Add an integration test that verifies the Flatpak-Upgrade-From HTTP
header is correctly sent during update operations but absent during
fresh installs. This header is used by Flathub to distinguish updates
from new installs in download statistics.

To support the test, extend web-server.py to optionally log Flatpak-*
request headers to a separate file.
2026-04-21 11:28:31 +00:00
Gordon Messmer
fffe38a2b0 common: Report the age of the configuration
This change will allow applications to determine if their data
is older than the flatpak configuration, to aid cache invalidation.
2026-04-20 14:00:20 +00:00
Sebastian Wick
43642337e4 dir: Try to delete the remote if we failed to add it entirely
Ideally, we would be able to atomically add and remove remotes, but
we're very far from that ideal state. The current behavior is really
suboptimal and leaves the remotes in a inconsistent state if
initialization failed. We can at least make it better by trying to clean
up the half-initialized mess we're currently in. It does however not
protect against SIGKILL-like aborts, as that would require it to be
atomic.

Closes: #6449
Co-authored-by: craftyguy "Clayton Craft" <clayton@craftyguy.net>
2026-04-20 13:59:14 +00:00
lumingzh
7781da7767 update Chinese translation 2026-04-19 05:35:30 +05:30
Razze
3f2e10e274 tests: add missing assertions after second flatpak_usb_parse_usb_list call
The call to flatpak_usb_parse_usb_list() lacked the
g_assert(ret) and g_assert_no_error(error) guards that are present
on the first call.
2026-04-18 20:33:07 +05:30
emintufan
1ae9b4a4e8 Update Turkish translation 2026-04-18 18:33:04 +05:30
Sebastian Wick
5314d8cf93 dir: Succeed ensure_repo with allow_empty when system helper fails
If _flatpak_dir_ensure_repo is called with allow_empty=true, it is
allowed to fail to create the repo, and is supposed to return success in
that case.

The system helper handles this correctly, but we then call to
ensure_repo_opened no matter if the repo actuall exists and return an
error when it does not, no matter if allow_empty is set or not.

Closes: #6618
2026-04-16 15:24:46 +00:00
Sebastian Wick
3c843932aa tests: Use meson to enumerate the tests
This gets rid of the test-matrix generation, and instead enumerates all
the tests in meson.

Some people (including me) constantly modified the generated meson
instead of the test-matrix generator file because they find it so
uncommon and unusual that a meson file is generated.

This looses the combinatorial combination of the generated system, but
in practice, six lines of enumeration is not bad, and it makes things
easier to understand.
2026-04-16 12:00:46 +00:00
Sebastian Wick
e556544833 doc: Document the new has-usb-device and has-usb-portal conditionals 2026-04-16 10:37:45 +00:00
Sebastian Wick
72576c8239 context: Add USB Portal conditional
This can be used by apps to restrict access to `--device=usb` by using
the portal and falling back to `--device=usb` if it is not available:

   --device-if=usb:!has-usb-portal

Closes: #6557
2026-04-16 10:37:45 +00:00
Sebastian Wick
b9da5795ed context: Add always-true USB device conditional
This can be used by apps to restrict access from `--device=all` to
`--device=usb` in a backwards compatible way:

   --device-if=all:!has-usb-device --device=usb

Closes: #6557
2026-04-16 10:37:45 +00:00
Cathy Hu
74027a9642 selinux: flatpak.if should be installed in distributed (bsc#1262051)
instead of `contrib`. Otherwise interfaces might clash with the
interfaces from the main policy on fedora and openSUSE.

See the independent policy guideline:
https://fedoraproject.org/wiki/SELinux/IndependentPolicy#Using_custom_interfaces

And:
https://bugzilla.opensuse.org/show_bug.cgi?id=1262051
2026-04-14 13:54:41 +00:00
Sebastian Wick
6fc45b139a portal: Actually use the AppInfo hash table
Before this change, the hash table was populated with the keyfile as key
and value, but the lookup and invalidate was done on the sender as the
key.

We never found a previous sender, and never invalidated one.

Fix this by actually using the sender as the key.
2026-04-13 17:21:33 +00:00
razzeee
655ddb42ec tests: add test-run-custom.sh to test matrix source
test-run-custom.sh was only manually appended to test-matrix/meson.build
and would be lost on regeneration. Add it to update-test-matrix so it is
properly managed.
2026-04-13 16:00:54 +00:00
Sebastian Wick
71034dd024 subprojects: Update dbus-proxy.wrap to v0.1.7
Versions up to 0.1.6 contain a security vulnerability, so let's bump it
to a version which does not.
2026-04-13 17:02:22 +01:00
Simon McVittie
333459c883 dir: Use flatpak_bwrap_child_setup_inherit_fds_cb() to apply extra-data
This is functionally equivalent to the local child_setup() deleted by
this commit, except that it ignores lseek() errors, which can
legitimately happen when inheriting a non-seekable file descriptor.
Since commit ac62ebe "run: Use O_PATH fds for the runtime and app
deploy directories", any extra-data helper that runs inside a runtime
will receive a non-seekable O_PATH fd as its /usr.

Resolves: https://github.com/flatpak/flatpak/issues/6608
Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-04-12 21:47:03 +00:00
Simon McVittie
dc9173b2d3 bwrap: Clarify a comment
Now that we're passing the app's /app and /usr down to bwrap as O_PATH
file descriptors, it will be even more common to have non-seekable fds
in the array.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-04-12 21:47:03 +00:00
Razze
51cff37bea tests: fix copy-paste bug checking mid_high instead of highest 2026-04-12 07:37:43 +05:30
Razze
758a096d72 tests: remove duplicate g_mkdir_with_parents call for dont_hide in test_full 2026-04-12 07:25:11 +05:30
Simon McVittie
0337cfde00 subprojects: Ignore .wraplock file generated by recent Meson
Signed-off-by: Simon McVittie <smcv@collabora.com>
2026-04-12 07:23:58 +05:30
Sebastian Wick
ed048c91b9 Post-branching version bump 2026-04-10 19:54:10 +02:00
Sebastian Wick
9b21874f1a 1.17.6 1.17.6 2026-04-10 19:51:18 +02:00
Sebastian Wick
1d1d189ada Update translation files for 1.17.6 2026-04-10 19:51:18 +02:00