8238 Commits

Author SHA1 Message Date
Sebastian Wick
0835c0272f Update translation files for 1.17.0 1.17.0 2025-11-03 16:33:21 +01:00
Sebastian Wick
0085420a90 Update NEWS for 1.17.0 release 2025-11-03 16:33:21 +01:00
Sebastian Wick
4b2e21e0b6 ci: Get rid of paths-ignore to ensure all PRs can be merged
We require jobs to succeed before a PR can be merged. If a PR only
touches files which match `paths-ignore`, the jobs won't run and the PR
can't be merged.

The number of PRs which only touch those files is small, and the extra
CI runs resulting from that can be ignored.
2025-11-03 16:33:21 +01:00
filmsi
2c354352bf Update sl.po (Slovenian)
Due to new/updated English strings here is the update.
2025-10-31 23:58:53 +05:30
Sebastian Wick
c4af112df4 transaction: Handle --include-sdk if SDK is installed in other dir
If an SDK is already installed in a dir that is not targeted with a
flatpak transaction, and the transaction has auto_install_sdk set,
add_new_dep_op returns NULL in dep_op which is not correctly handled in
add_deps.

Fixes #5894
2025-10-31 12:58:39 +00:00
Sebastian Wick
8354ee56cf kill: Do not kill pid 0 and embrace races
There are a number of races, and failure conditions which can lead to a
pid of 0 being returned from flatpak_instance_get_child_pid. This would
lead to a whole bunch of things getting killed.

We will skip the instance in those cases now, and retry a few times. We
also notice when the instance just goes away by itself now.

This should make killing more robust, and especially not SIGKILL pid 0.
2025-10-31 12:04:55 +00:00
Sebastian Wick
0fc61c1aff doc: Document the new Conditional Permissions system
The system was introduced in b93b58a4 ("context: Add new
FlatpakPermission(s) type") but we forgot to add documentation.
2025-10-30 11:29:16 +00:00
Sebastian Wick
842472d234 transaction: Preinstall from first remote with ref
We could previously just assume that the first enabled remote
(potentially matching the collection ID) contains the ref, but that
obviously is not always the case.

The change here looks up the remote state of the remotes to figure out
if they actually contain the ref, and adds the first matching remote to
the transaction.
2025-10-30 11:21:35 +00:00
Georgia Garcia
f61d931da8 common: Fix running_under_sudo check by checking euid
Sudo can be used in several ways other than calling a command with the
root user. For example, one can use -u to run the command as the
specified user, or -g to specify a primary group to run the command
as.

Flatpak adds a check when --user is used to prevent an installation in
the root's directory, for example, but it does it by only checking if
sudo was used. As stated previously, it does not necessarily imply
root, so this patch explicitly checks if the command is being run with
the root user.

Fixes: https://github.com/flatpak/flatpak/issues/5979
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-10-28 13:17:13 +00:00
Sebastian Wick
edac357aad builtins/install: Allow flatpak+https URIs in flatpak install --from
Those schemes are in use by flathub, usually to be handled by an app
store, but we can also handle it directly with `flatpak install`.

Base on an idea from user bbb651 in
https://github.com/flatpak/flatpak/pull/6259.
2025-10-28 12:55:59 +00:00
JakobDev
3544de6251 build-finish: Export AppStream external release metainfo
The appstream docs say:

  Release data may be present directly in a component metainfo file, but
  also optionally be split out into an external metadata file.

  The file must be installed as
  /usr/share/metainfo/releases/%{cid}.releases.xml, where cid is the
  component ID of the component the release information belongs to.

This change allows flatpak build-finish to export those external release
files.

Closes #6057
2025-10-28 10:22:45 +00:00
lumingzh
32347168e3 update Chinese translation 2025-10-28 00:53:43 +00:00
Kolja Lampe
b6775dc221 http: Add cancellation support for curl downloads and error handling 2025-10-28 00:21:01 +00:00
Sebastian Wick
1372e16d05 dir: Check parental control authorization via system bus name
PIDs are pretty much always a bad idea because they can be racy. The
authorization did use the PID though. We can replace it by a check via
the system bus name.

Closes: https://github.com/flatpak/flatpak/issues/6212
2025-10-27 13:37:26 +00:00
Sebastian Wick
6fd0930858 system-helper: Take a dbus invocation for dir_get_system
We can internally use it to get the PID instead.
2025-10-27 13:37:26 +00:00
Sebastian Wick
3e9e68cc5d Support sideload repositories for OCI remotes
For OCI remotes, the existing sideload repository system doesn't
work: identity for OCI remotes is done by manifest digest (disguised
as a fake commit ID internally), instead of by ostree commit, so
we have no way of knowing whether a sideloaded image matches the
summary.

Allow specifying a new form of sideload repository with:

  --sideload-repo=oci:<path>

The desired use case for this is preinstalling Flatpaks during OS
install, and for this, binding the entire repository to a single
collection ID is both inconvenient and not useful, so OCI sideload
repostories don't have a defined collection ID - they just apply to
all OCI remotes. (And, because of this, they are restricted to
the command line.)
2025-10-24 16:27:33 +00:00
Sebastian Wick
621790e797 transaction: Support sideloading from OCI repos/archives
This allows adding FlatpakImageCollection sideload repositories to a
transaction.
2025-10-24 16:27:33 +00:00
Sebastian Wick
f7671ebbc9 dir: Support sideloading from OCI repos/archives
This is implemented in a straightforward way by adding GFile
*sideload_path, FlatpakImageSource *image_source.
2025-10-24 16:27:33 +00:00
Sebastian Wick
51bf27c0d9 dir: Add sideload image collections and is_oci helper
They will be used in the next commit to better deal with sideloading OCI
images.
2025-10-24 16:27:33 +00:00
Sebastian Wick
b486437c8e image-source: Add a method to get the summary metadata 2025-10-24 16:27:33 +00:00
Sebastian Wick
feb2220a46 image-collection: Add the new FlatpakImageCollection class
The new FlatpakImageCollection class represents a set of
FlatpakImageSource loaded from the image sideload repository.
2025-10-24 16:27:33 +00:00
Sebastian Wick
9551f7d402 image-source: Make flatpak_image_source_new public
And check that the digest is a sha256 hash.

Will be used in the next commits.
2025-10-24 16:27:33 +00:00
Owen W. Taylor
86b000c34b dir: Don't return a VarRefInfoRef from flatpak_remote_state_lookup_ref()
The memory management of returning a VarRefInfoRef is tricky - it
points to data owned by the summary or the sideload repo. External
consumers were always retrieving a copy of the summary metadata,
so make the public function do that.
2025-10-24 16:27:33 +00:00
Sebastian Wick
bc5c8e65be dir: Handle NULL sideload state in flatpak_remote_state_lookup_ref
Even on success, flatpak_remote_state_resolve_sideloaded_ref might
return a NULL FlatpakSideloadState. Handle it properly.
2025-10-24 16:27:33 +00:00
Kolja Lampe
e069452d7c utils-http: remove duplicate pointer clearing for hdr_last_modified 2025-10-22 00:29:54 +00:00
lumingzh
e2011c27f7
Update Chinese translation 2025-10-21 07:00:54 +05:30
Achill Gilgenast
bd468a8959 tests: Dont add locales to test runtime on musl
musl libc doesn't provides locales under /usr/share/locales. The tests
still run fine without copying locale under musl.
2025-10-14 09:53:05 +00:00
Sebastian Wick
0a3c2452c0 flatpak-build: Drop host permissions by default
For some reason, flatpak build always had host permissions set by
default. There really isn't a good reason for this. The build should be
isolated from the host as much as possible by default.
2025-10-13 19:24:50 +00:00
Chris Williams
a7ac4206c6 dir: Also reload repo configuration after setting via system helper
Without doing so, flatpak_dir_get_config() won't reflect changes made
with flatpak_dir_set_config().

This fixes passing multiple patterns to `flatpak mask` for the system
installation.

Closes #5464
2025-10-13 19:14:44 +00:00
d34db3ff
65f5c98e11 session-helper: track the destinations of broken symlinks
Fixes #4268

Make sure that session-helper always tracks the destinations of symlinks.
This fixes a race condition on systems where '/etc/resolv.conf' is a symlink.
2025-10-13 19:02:44 +00:00
bbhtt
0bf531f44a dir: Add basic OS info to Flatpak-Os-Info header when pulling objects
Fixes https://github.com/flatpak/flatpak/issues/5549
2025-10-13 18:52:55 +00:00
Sebastian Wick
8a21f2dfe1 tests/test-http-utils.sh: Only use have_xattr if we have setfattr
Otherwise we try to call setfattr which fails and have_xattr reports
that there is no xattr support. This might then obviously be wrong and
the test can fail because of that.
2025-10-13 18:42:55 +00:00
Sebastian Wick
78b3c47c13 tests/test-run.sh: Only test for trigger results if we have the deps
If the binaries are not available in the environment, the trigger will
not do anything. The tests will not know about this and fail. So only
test for the results of the triggers if they have the dependencies they
require.
2025-10-13 18:42:55 +00:00
Sebastian Wick
c38e481fb4 context: Handle x11-fallback by converting to a conditional
This internally converts `x11-fallback` to `if:x11:!has-wayland` at
the earliest place possible, and converts back when serializing to a
file.
2025-10-13 18:31:33 +00:00
Sebastian Wick
a92c5f686e context: Support condtional permissions for socket and devices
This uses the new FlatpakPermissions API to support the new
commandline options --socket-if= and --device-if=.
2025-10-13 18:31:33 +00:00
Alexander Larsson
b93b58a44e context: Add new FlatpakPermission(s) type
This adds a new type that is meant to track more complex permissions
than a pure bitmask, including conditional dependencies. It is not yet
used, but it will be used for at least the socket and device
permissions.

For each possible permission we track whether the permission is
unconditionally allowed, unconditionally disallowed, or if it is
conditionally allowed (allowed if some conditions are met).

Additionally we track for each permission whether stacking the context
on top of another will reset permissions in the layer below. This is a
new feature, because previously merging layers *always* overrode the
value from below, whereas conditional permissions can either stack on
top of, or replace the underlying layer.

In terms of the keyfile, there are 4 possible types of layers:

1) Add a permission, removes all partial permissions below
socket=pipewire

2) Remove access, removes both partial and full permissions below
socket=!pipewire

3) Adds a partial permission, keeping whatever is already there:
socket=pipewire;pipewire:if:has-wayland
Note: This adds a plain `pipewire` for backwards compat.
Note: If parent has full pipewire access, this is a no-op.

4) Adds a partial permission, remove all previous access
socket=!pipewire;pipewire;pipewire:if:has-wayland
Note: This seems weird as it has both !pipewire and pipewire, but older versions
will read these in order and get the right result.

Additionally, partial permissions can have multiple conditions:
socket=pipewire;pipewire:if:has-something;pipewire:if:has-other;

In such a case the socket will be accessible if any condition matches.

Conditions can also be negated:
socket=pipewire;pipewire:if:!has-something;

Due to backwards compatibility we have to add the non-conditional
permission as well as the conditional, as older flatpak will ignore
the conditional. This is handle when serializing/deserializing the
permissions, and internally we don't have to care about this.
2025-10-13 18:31:33 +00:00
Sebastian Wick
5852e6f5e6 common: Pass the context to flatpak_context_*_to_args
Instead of pulling out data from the context and passing it to the
function. This allows to make further changes to the function which
require more data from the context.
2025-10-13 18:31:33 +00:00
Sebastian Wick
e74709b6ce common: Let flatpak_context_bitmask_to_string populate a GPtrArray
This moves the allocation of the GPtrArray to the caller which will
become useful in a future commit because another function can add more
elements to the same array.
2025-10-13 18:31:33 +00:00
Sebastian Wick
25e1a2a257 common: Split out parts of flatpak_context_load_metadata
Those functions will become a bit more complex in future commits and
this prevents flatpak_context_load_metadata from becoming increasingly
complex.
2025-10-13 18:31:33 +00:00
Alexander Larsson
5c12cd83a1 tests: Add support for adding internal tests
If the internal_tests option is enabled we build some internal tests
into the binary. These are added to the tests we run in testlibrary.

This is not intended to be enabled in production, as it adds size to
the real binary, but is useful for CI and development.
2025-10-13 18:31:33 +00:00
Sebastian Wick
14bfb56ba3 tests: Make it possible to use mesontest --test-args
This makes it possible to pass arguments to g_test_init via mesons
--test-args. This can be useful when one wants to run a single test with
`meson test testlibrary --test-args='-p /context'.
2025-10-13 18:31:33 +00:00
bbhtt
9dccb7a722 repo-utils: Drop stripping .desktop suffixes from appstream cids
This will pass the exact appstream component ID to copy_icon

This was introduced in 7dd92d8a9be2e14313e2cda7dea44298fbb005a4 to
handle appstream component IDs that ended in two `.desktop` suffixes.

Recent analysis of appstream data shows that at least on Flathub no such
appstream cid exist anymore and Telegram now has component ID
`com.telegram.desktop`.

With the switch to libappstream, appstreamcli-compose produces icons in
`share/app-info/flatpak` named by the appstream component ID instead of
the `$FLATPAK_ID` used by appstream-glib. This causes applications whose
`$FLATPAK_ID` does not end with `.desktop` but their appstream-component
ID ends in `.desktop` ie. `$FLATPAK_ID != appstream-cid` to loose icons
from the appstream ostree ref as `copy_icon` was being fed the id
without `.desktop` but icons were created by appstreamcli
with `.desktop` in them.

This will avoid adding anymore ID heuristics/workarounds on either side,
per the discussion in [1].

An application with the `$FLATPAK_ID` `com.telegram.desktop` and the
appstream ID `com.telegram.desktop.desktop` will be broken with this
change but such dual `.desktop` IDs are non existent and should be fixed
individually or be blocked on an app store level.

[1]: https://github.com/flathub/flathub/issues/4222
2025-10-13 14:07:33 +00:00
lumingzh
cfb89ce026 update Chinese translation 2 2025-10-13 13:54:32 +00:00
lumingzh
750b5567ed update Chinese translation 2025-10-13 13:54:32 +00:00
Adian Kozlica
4f8b935567 feat: json support for table printer 2025-10-13 13:53:15 +00:00
Sebastian Wick
815301f341 doc: Build libflatpak-doc.html
Closes #4591
2025-10-10 10:04:37 +00:00
Sebastian Wick
a57f6bc372 portal: Clear the environment via flatpak arguments
Instead of clearing the environment that we spawn the flatpak executable
with, we use the new --clear-env. For environment variables that we
inherit from the calling instance, we append them as arguments after the
--clear-env so it starts from a clean slate.

Closes: https://github.com/flatpak/flatpak/issues/5271
2025-10-09 18:02:50 +00:00
Sebastian Wick
f760f1b539 run: Add --clear-env option for clearing the outside environment 2025-10-09 18:02:50 +00:00
Luca Boccassi
4c75a168e3 meson: switch default dbus_config_dir to /usr/share/dbus-1/
Upstream/vendor configuration files should be installed under /usr/,
so that local users/admins can install overrides in /etc/.
Distributions like Ubuntu are already manually configuring this,
so just make it the default.
2025-10-09 16:24:52 +00:00
bbhtt
cd0212aa40 utils-http: Fix an uninitialised variable warning
Fixes c75ba1c7e1587300be9a418116c02d0b6bf8b34e

```
In file included from /usr/lib/aarch64-linux-gnu/glib-2.0/include/glibconfig.h:9,
 from /usr/include/glib-2.0/glib/gtypes.h:34,
 from /usr/include/glib-2.0/glib/galloca.h:34,
 from /usr/include/glib-2.0/glib.h:32,
 from /usr/include/glib-2.0/gobject/gbinding.h:30,
 from /usr/include/glib-2.0/glib-object.h:24,
 from /usr/include/glib-2.0/gio/gioenums.h:30,
 from /usr/include/glib-2.0/gio/giotypes.h:30,
 from /usr/include/glib-2.0/gio/gio.h:28,
 from ../common/flatpak-utils-http.c:23:
In function ‘glib_autoptr_clear_GFileEnumerator’,
 inlined from ‘glib_autoptr_cleanup_GFileEnumerator’ at /usr/include/glib-2.0/gio/gio-autocleanups.h:69:1,
 inlined from ‘flatpak_get_certificates_for_uri’ at ../common/flatpak-utils-http.c:284:34:
/usr/include/glib-2.0/glib/gmacros.h:1361:10: warning: ‘enumerator’ may be used uninitialized [-Wmaybe-uninitialized]
 1361 | { if (_ptr) (cleanup) ((ParentName *) _ptr); } \
 | ^
/usr/include/glib-2.0/glib/gmacros.h:1379:3: note: in expansion of macro ‘_GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS’
 1379 | _GLIB_DEFINE_AUTOPTR_CLEANUP_FUNCS(TypeName, TypeName, func)
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/glib-2.0/gio/gio-autocleanups.h:69:1: note: in expansion of macro ‘G_DEFINE_AUTOPTR_CLEANUP_FUNC’
 69 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GFileEnumerator, g_object_unref)
 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../common/flatpak-utils-http.c: In function ‘flatpak_get_certificates_for_uri’:
../common/flatpak-utils-http.c:284:34: note: ‘enumerator’ was declared here
 284 | g_autoptr(GFileEnumerator) enumerator;
```
2025-10-08 14:14:50 +00:00