Commit Graph

5906 Commits

Author SHA1 Message Date
Alexander Larsson
4c9ff0fb7d oci authenticator: Only loop password prompt on 401 error 2020-06-09 14:52:00 +02:00
Alexander Larsson
743619141f oci authenticator: Translate some missing strings 2020-06-09 14:52:00 +02:00
Alexander Larsson
52293015d9 oci-registry: Translate some missing errors 2020-06-09 14:52:00 +02:00
Alexander Larsson
ac9e86eb8f OCI Authenticator: Report error code in errors 2020-06-09 14:52:00 +02:00
Alexander Larsson
d9b0d10b0c Transaction: Accept error-code option in error responses
This allows authenticators to pass a FlatpakError instead of
always generating FAILED errors.
2020-06-09 14:52:00 +02:00
Alexander Larsson
df4834371a Add AUTHENTICATION_FAILED and NOT_AUTHORIZED error codes
These allow us to report more details from authenticators
2020-06-09 14:52:00 +02:00
Alexander Larsson
8fd4277ba9 portal: Avoid use of g_error()
Use g_warning instead, because it is not fatal.
2020-06-09 13:51:02 +02:00
Ryan Gonzalez
c690eb90e4 portal: Add SpawnStarted and notify-start
These can be used to monitor when a spawned child process has fully
started and to get its relative PID.
2020-06-09 13:51:02 +02:00
Ryan Gonzalez
f687f6b2eb run: Add --instance-id-fd 2020-06-09 13:51:02 +02:00
Alexander Larsson
4d1899b1d7 Allow ALSA device access if app has pulseaudio access
Alternative fix to https://github.com/flatpak/flatpak/pull/3389

If an app has PulseAudio access, also allow direct ALSA device access.

The practical permissions of ALSA and PulseAudio access are
essentially the same (in fact, its possibly less damaging to have
direct device access as bugs in pulseaudio could allow sandbox
breakout that wouldn't be possible with deivce access).

We could add a separate option for this, but since they are
essentially the same, and since both are not the end goal (which is
using portals and PipeWire for audio), seems like unnecessary churn in
apps and code.
2020-06-09 10:38:49 +02:00
Alexander Larsson
0978826c2e Add and use per-transaction no-interaction option
This is useful if to avoid changing the no-interaction of the whole
FlatpakInstallation. Also, having this per transaction lets us
clean up the code in FlatpakQuietTransaction a bit.
2020-06-09 10:38:25 +02:00
Yuri Chornoivan
a3f225683f Update Ukrainian translation 2020-06-09 09:25:19 +02:00
Matthew Leeds
a994cdb30e tree-wide: Replace usages of whitelist/blacklist
The terms whitelist and blacklist are hurtful to some people, and per
our code of conduct Flatpak is an inclusive community. Replace them with
allowlist and blocklist which are also more clear. This terminology
change is being implemented more broadly in the software industry; see
e.g. https://go-review.googlesource.com/c/go/+/236857/
2020-06-09 09:24:48 +02:00
Bartłomiej Piotrowski
6d9f9273c8 remote-add: Add --no-follow-redirect 2020-06-08 12:13:20 +02:00
Bartłomiej Piotrowski
5a82a599b1 remote-modify: Add --follow-redirect and --no-follow-redirect 2020-06-08 12:13:20 +02:00
Bartłomiej Piotrowski
2fe18ed560 remote-modify: Set url-is-set to true when changing URL
Assume that if user explicitly modifies the URL, they want to keep
using that URL instead of having it overwritten by xa.redirect-url.
2020-06-08 12:13:20 +02:00
Alexander Larsson
f7cf263af7 Fix race when generating ld.so.cache
While creating the ld.so.cache file we write to a temporary file
and then rename it to the final reused cache location only when it is
completely finished.

This solves two issues:
 a) New app instances never end up with a cache that is not finished
 b) Two app starting at the same time don't both try to write the
    cache in the same place, failing like in #3029.

This is an alternative fix to https://github.com/flatpak/flatpak/pull/3617
2020-06-08 11:35:14 +02:00
Alexander Larsson
52f33bc3f6 flatpak_switch_symlink_and_remove don't remove old if same as new
If we're switching to a target which happens to be the same as the old
one, don't remove the old one (as it is also the new one).
2020-06-08 11:35:14 +02:00
Léo Stefanesco
3ab3f62f58 Fix flatpak enter being multi-threaded and failing
flatpak enter must not be multi-threaded because it calls setns. This
was causing a problem because g_vfs_get_default spawns threads in some
environments.
2020-06-08 09:14:21 +02:00
Matthew Leeds
4117fe0955 Merge pull request #3616 from refi64/remote-add-seg
remote-add: Don't make the repo existence optional
2020-06-05 13:25:10 -07:00
Léo Stefanesco
66dfb63075 Fix segfault when reporting error during install
flatpak_dir_install was returning FALSE but leaving error to NULL, which
would crash when printing the error.

Fixes #3646
2020-06-05 17:02:45 +02:00
Ryan Gonzalez
1735d88f01 Clean up duplicated instance collection code
It was completely identical in flatpak-run.c and flatpak-instance.c.
2020-06-05 16:36:13 +02:00
alaviss
ea1830e108 common/flatpak-run: respect user's XDG base directories (#3626)
This makes flatpak respects XDG_DATA_HOME and XDG_CACHE_HOME for binding
user's fonts and icons into the sandbox.
2020-06-05 16:31:39 +02:00
Nikola Knazekova
669a5bf671 Add unconfined_domain(flatpak_helper_t) to optional_policy block
Fixed bug where disabling unconfined module fails because macro unconfined_domain(flatpak_helper_t) wasn't in optional_policy block
2020-06-05 16:27:39 +02:00
Alexander Larsson
b042abc71c oci: Handle io.github.containers.DeltaUrl in index
If the magical io.github.containers.DeltaUrl label is set in the
index, then try to download this to use as the delta manifest for the
image. This allows servers to store deltas outside the registry
itself. The label is propagated to the xa.delta-url metadata in the
generated "fake summary" for the remote, and read back on pull.

Note that the delta manifest layers descriptor will need to have a
"urls" key where it references the blobs if the blobs are also not
stored on the registry.

If the specified manifest doesn't exist or doesn't apply to the target
image we fall back to resolving via the _deltaindex tag.
2020-06-05 09:35:30 +02:00
Alexander Larsson
fd197300b9 oci: Fix potential crash
Call flatpak_remote_state_ensure_summary() before dereferencing
RemoteState->summary to return an error instead of crashing if
downloading the summary failed.
2020-06-05 09:35:30 +02:00
Alexander Larsson
47daa077c2 OCI: Support (and use) alternative urls specified in OCI descriptors 2020-06-05 09:35:30 +02:00
Alexander Larsson
aaa36bab45 oci: Support deltas when using system-helper
When mirroring to a local OCI dir we apply deltas and generate
uncompressed layer blobs instead of regular blobs. Then we pick this
up on the system-helper side.
2020-06-05 09:35:30 +02:00
Alexander Larsson
f2cb157294 oci: Use the correct progress layer size when using deltas 2020-06-05 09:35:30 +02:00
Alexander Larsson
37dcccea61 oci: Add flatpak_oci_registry_apply_delta_to_blob()
This is a version of flatpak_oci_registry_apply_delta() that generates
a new blob in a local repo, rather than a temporary file. This is used
when mirroring using a delta into a child oci registry for system-helper
use.
2020-06-05 09:35:30 +02:00
Alexander Larsson
5d8fd2d1be oci: Set token on child oci registry and pass to system-helper
When we create a system child registry we also set the current token on
it. This is not used directly in the client, however its saved in a
file called .token and re-read in the system-helper, allowing it to
also do the remote registry operations it needs to verify the child
registry.
2020-06-05 09:35:30 +02:00
Alexander Larsson
d4962628aa oci: Add flatpak_oci_registry_is_local() 2020-06-05 09:35:30 +02:00
Alexander Larsson
8c454f99f2 oci: Add debug spew when using deltas 2020-06-05 09:35:30 +02:00
Alexander Larsson
4539d186a5 oci: Make libzstd optional (and disable OCI deltas if not there) 2020-06-05 09:35:30 +02:00
Alexander Larsson
31612d7568 CI: Add libzstd-dev dependency 2020-06-05 09:35:30 +02:00
Alexander Larsson
7be653a14d oci: Find and apply available deltas when pulling 2020-06-05 09:35:30 +02:00
Alexander Larsson
0fce4c6d7f oci: Pass FlatpakPullFlags to pull_from_oci()
We want to handle FLATPAK_PULL_FLAGS_NO_STATIC_DELTAS
2020-06-05 09:35:30 +02:00
Alexander Larsson
abf5b2db44 oci: Add basic functions to find and apply OCI deltas
This is based on the OCI delta work at:
  https://github.com/containers/image/pull/902
2020-06-05 09:35:30 +02:00
Alexander Larsson
3d8ca04565 oci: Add helpers to parse OCI delta index and manifest 2020-06-05 09:35:30 +02:00
Alexander Larsson
eaeb52b6a3 flatpak_oci_registry_load_blob: Allow tags (and digests) arg
We typically only load by digest id, resolving tags in other ways.
However, we need to load the _deltaindex tag by tagname, so support
this when possible.
2020-06-05 09:35:30 +02:00
Alexander Larsson
29da4ca430 oci: Store the last layer diff-id in the commit metadata (xa.diff-id)
We an use the commit content as original data for deltas going from
this diff-id, so this will be useful later.
2020-06-05 09:35:30 +02:00
Alexander Larsson
90f5fdb44d oci: Add flatpak_oci_image_get_n_layers() helper 2020-06-05 09:35:30 +02:00
Alexander Larsson
e0a25e7650 http: Also accept image indexes when FLATPAK_HTTP_FLAGS_ACCEPT_OCI 2020-06-05 09:35:30 +02:00
Alexander Larsson
01919d251e oci: Use content type from server if not in contents 2020-06-05 09:35:30 +02:00
Alexander Larsson
7820057336 Add content_type output to flatpak_load_uri()
We want this to get the oci mimetypes
2020-06-05 09:35:30 +02:00
Alexander Larsson
bfa71e208a Add FlatpakZstdDecompressor converter (and libzstd dep)
We will need this to decompress oci deltas.
2020-06-05 09:35:30 +02:00
Alexander Larsson
8e0e5a5749 oci: Always checksum entire layer when pulling
It turns out that libarchive doesn't always read the entire file until
the end if it can figure out that the tarfile ended. Normally this is
not hit, because the decompressor reads all the input, but for
uncompressed tarfiles (like those from applied deltas) this is
important.
2020-06-05 09:35:30 +02:00
Alexander Larsson
c2529d0bf8 oci: Use /var/tmp for tmpdir instead of /tmp
The files we're creating could potentially be large, so lets
not overflow ram if /tmp is a tmpfs.
2020-06-05 09:35:30 +02:00
Matthew Leeds
f44afe9d60 Merge pull request #3629 from cho2/l10n
Update Indonesian translation
2020-05-31 09:53:10 -07:00
Kukuh Syafaat
fea5074840 Update Indonesian translation 2020-05-30 22:26:47 +07:00