Commit Graph

6704 Commits

Author SHA1 Message Date
Phaedrus Leeds
49d9052d22 Ensure refs are updated from their origin
It can happen that a related ref is installed from a different remote
than the thing it's related to. We always want to update things from
their origin remote. However as of now FlatpakTransaction resolves the
commit of a related ref to the one available from the main ref origin,
and later sets the remote for the operation to the installed origin (see
commit 6793d90b8). In case there is a newer commit in the main ref
origin than the installed origin, this leads to an update operation
being erroneously created, only to then error out with an HTTP 404
error, because the commit from the main ref origin is being pulled from
the installed ref origin. For specific steps to reproduce see
https://github.com/flatpak/flatpak/issues/3128#issuecomment-948948040

So, ensure that when a FLATPAK_TRANSACTION_OPERATION_INSTALL_OR_UPDATE
operation is created for something that's installed, whether it's a
related ref or something else, the remote used is always the origin. And
ensure that the remote is set correctly before the stage where the op is
resolved to a commit, to avoid the situation described above. This is
essentially a re-implementation of the fix in commit 6793d90b8.

Also, add a unit test for this behavior.

This commit also makes a few changes to documentation to make it clear
that this related-ref-different-origin situation is possible.

Fixes #3128
2021-11-15 11:18:58 +01:00
Phaedrus Leeds
3aa9a7f3a1 app: Fix behavior when installing end-of-life-rebased ref
Currently if the user specifies a ref to install that has been renamed
via the end-of-life-rebased mechanism, for example "flatpak install
com.visualstudio.code.oss", Flatpak erroneously tries to install both
the old and new versions of the app. This happens because the code
handling end-of-life-rebase conditions is written assuming the rebased
app is being updated rather than installed for the first time.

Specifically, in FlatpakCliTransaction and FlatpakQuietTransaction, in
end_of_lifed_with_rebase(), we treat a failure of
flatpak_transaction_add_uninstall() as fatal and return FALSE from the
signal handler, which means that the install operation that triggered
the signal will not be skipped (see the docs for
FlatpakTransaction::end-of-lifed-with-rebase).

So, instead check for the FLATPAK_ERROR_NOT_INSTALLED error code and
ignore it, so that the installation of the old version of the renamed
app will be properly cancelled.

Fixes https://github.com/flatpak/flatpak/issues/3754
2021-11-15 11:13:51 +01:00
Patrick Griffis
cda4967a9e Re-enable HTTP compression
The original commit (9865ed8989) disabling
it claimed it fixed OCI downloads. This no longer seems to be a problem.

This has also exposed new bugs as some servers will send
gzip compressed data when the client does not send Accept-Encoding.
If we leave this enabled that issue goes away.
2021-11-15 11:12:01 +01:00
Simon McVittie
e2b36d3f1c tests: Assert that XDG_foo_HOME directories are all created
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
19a93a8427 run: Always create .local/state directory
This is placed at the same location that would be used by
the --persist=.local/state option.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
a3464bebb7 tests: Check that we handle XDG_foo_HOME as intended
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
3acdb37fc6 doc: Mention how to get a compatible ~/.local/state with older versions
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
871e684eab doc: Mention that setting XDG_STATE_HOME is a new feature
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Simon McVittie
2e28fa39e8 run: Mention why we're using .local/state
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-15 11:07:57 +01:00
Lionir
0fda062c96 Add XDG_STATE_HOME and HOST_XDG_STATE_HOME env variables
This gives new support for the new XDG_STATE_HOME addition to XDG_BASE_DIRS
which allows applications to use this without breaking because they would
assume $HOME/.local/state which may be unavailable to the flatpak

This adds it as .local/state as to make --persist=.local/state the same behaviour
as in new flatpak. This in turn means that the transition should be seamless between
old and new flatpak.

This also has the benefit of working if the application doesn't follow XDG spec thanks
to --persist=.local/state.

This fixes https://github.com/flatpak/flatpak/issues/4477

[smcv: Don't call nonexistent g_get_user_state_dir(); fix a reference
to XDG_STATE_DIR]
2021-11-15 11:07:57 +01:00
Phaedrus Leeds
17fbe516c4 build-update-repo: Don't try to generate deltas of unknown refs
Spotted this by code inspection. Ignoring such refs was clearly the
intended behavior based on the comment.
2021-11-15 10:55:50 +01:00
Ryan Gonzalez
d37c739f6c Add a profile script for Fish
Technically, Fish users can already make this work using
https://github.com/edc/bass, but it's also nice to have this working on
an out-of-the-box Flatpak installation.

Fixes #3109.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2021-11-15 10:44:55 +01:00
Phaedrus Leeds
86d6918a11 app: Don't use carriage return for non-fancy output
flatpak_fancy_output() determines whether the output we write is
intended for e.g. a tty or e.g. a log file, the latter being "not
fancy". Currently we write carriage return characters in the not fancy
case, but change that to new lines, which are interpreted correctly by
editors such as vim (whereas a carriage return shows up as ^M since it
is not the correct newline character on Unixy operating systems).
2021-11-15 09:57:09 +01:00
Phaedrus Leeds
20fd994c5c transaction: Fix signal Since annotations 2021-11-15 09:55:27 +01:00
Phaedrus Leeds
39de0ef280 search: Use <bundle> ID to determine flatpak app ID
The <bundle> element in the appstream data unambiguously provides the
full four-part flatpak ref, so use it to determine the app ID. But fall
back to using the <id> element, since that is required to be present.
2021-11-15 09:54:56 +01:00
Phaedrus Leeds
62e09b406b search: Don't strip .desktop suffix overzealously
This commit changes the search command to properly output the app ID for
IDs that end in .desktop, e.g. to print org.telegram.desktop rather than
org.telegram.

Fixes https://github.com/flatpak/flatpak/issues/4535
2021-11-15 09:54:56 +01:00
Phaedrus Leeds
f3214c59d2 dir: Fix an issue with fetch_remote_ref_sync()
This commit is a follow-up to "Fix implementation of xa.noenumerate
remote option" since that turned out to break
flatpak_installation_fetch_remote_ref_sync() in some cases. I didn't see
it at the time, but flatpak_decomposed_get_collection_id() explains that
the collection ID shouldn't be set on FlatpakDecomposed objects, even
when the remote has a collection ID set, unless they are being used to
enumerate refs from a file:// URI rather than a configured remote. So
this commit changes list_remote_refs() and list_all_remote_refs() to
keep the xa.noenumerate implementation working and to get
fetch_remote_ref_sync() working again (since the latter uses
flatpak_decomposed_new_from_parts() and thus doesn't set a collection ID
on the FlatpakDecomposed object used for comparison).
2021-11-15 09:48:03 +01:00
Phaedrus Leeds
fd4e9e84cd dir: Fix typos in a warning 2021-11-12 17:42:51 -08:00
Will Thompson
eabbff6fef run: Document shortcomings of PulseAudio server string parsing
These are just based on a cursory reading of the spec.
2021-11-11 16:38:11 +00:00
Will Thompson
bcc114383b run: Add link to PulseAudio server string documentation 2021-11-11 16:38:11 +00:00
Will Thompson
7534a970a5 run: Support PulseAudio socket path without unix: prefix
https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/ServerStrings/
says:

> If the string starts with / or unix: the remaining address string is taken as
> UNIX socket name.

but previously the string was only taken to be a UNIX socket name if it began
with "unix:".

This is an issue in practice with WSLg <https://github.com/microsoft/wslg>
which sets $PULSE_SERVER to "/mnt/wslg/PulseServer", without a "unix:" prefix.
2021-11-11 16:38:11 +00:00
Phaedrus Leeds
692ec8644e Merge pull request #4563 from gostsdmitry/patch-1
Update hi.po
2021-11-11 07:44:55 -08:00
Dmitry
baf5dd82a6 Update hi.po 2021-11-11 21:06:28 +07:00
Phaedrus Leeds
284edffe89 Merge pull request #4560 from gostsdmitry/patch-1
Update hi.po
2021-11-10 11:32:27 -08:00
Dmitry
dc81524a3f Update hi.po
Fixing errors and correcting them.
Correction of translation for the interface.
2021-11-11 01:28:22 +07:00
Phaedrus Leeds
4b89d92dbd SECURITY.md: Update supported branches 2021-11-10 12:28:02 +00:00
Phaedrus Leeds
cfdc5839fc Merge pull request #4556 from flatpak/drop-superfluous-cflags
tests: Drop some unneeded CFLAGS/LDADD
2021-11-09 11:57:56 -08:00
Phaedrus Leeds
1a95a1ec90 tests: Drop some unneeded CFLAGS/LDADD 2021-11-09 11:33:10 -08:00
Phaedrus Leeds
b2e577afdb Merge pull request #4555 from gostsdmitry/patch-1
Update hi.po
2021-11-09 10:27:34 -08:00
Dmitry
dbd1ad634a Update hi.po
Corrections.
2021-11-10 01:18:32 +07:00
Phaedrus Leeds
f7e2aa12cb Merge pull request #4553 from gostsdmitry/patch-1
Update hi.po
2021-11-09 08:06:36 -08:00
Dmitry
7f29f17aa5 Update hi.po
Minor fixes
2021-11-09 22:31:22 +07:00
Phaedrus Leeds
9074761391 Merge pull request #4548 from flatpak/hi-translation
Add Hindi translation
2021-11-08 18:49:30 -08:00
gostsdmitry
3a836e6568 Add Hindi translation 2021-11-08 17:54:14 -08:00
Phaedrus Leeds
85ce22cba3 Merge pull request #4546 from flatpak/issue-template-mention-flathub-repos
Add checkbox to issue template
2021-11-08 16:46:29 -08:00
Phaedrus Leeds
e9933b0022 Add checkbox to issue template 2021-11-08 11:41:59 -08:00
Phaedrus Leeds
998a300b29 dir: Fix a return of FALSE rather than NULL 2021-11-05 14:58:55 -07:00
Philip Withnall
cd2f796ba9 Merge pull request #4487 from flatpak/dont-mask-noenumerate-main-refs
dir: Don't mask the main ref of a noenumerate remote
2021-11-02 11:14:37 +00:00
Phaedrus Leeds
4da815f3b9 Merge pull request #4531 from smcv/session-helper-header
session-helper: Move FlatpakHostCommandFlags to header file
2021-11-01 13:01:49 -07:00
Simon McVittie
8c84823d56 session-helper: Add FLATPAK_HOST_COMMAND_FLAGS_NONE
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-01 15:15:40 +00:00
Simon McVittie
ccaa3ceacc session-helper: Move FlatpakHostCommandFlags to header file
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-11-01 15:14:44 +00:00
Phaedrus Leeds
684e68be09 Merge pull request #4517 from haaninjo/l10n-sv
Update Swedish translation
2021-10-28 10:36:11 -07:00
Phaedrus Leeds
89876b1a8d test-update-portal: Fix warn_unused_result warning 2021-10-27 10:58:38 +01:00
Phaedrus Leeds
f4d94d81a8 Merge pull request #4518 from pwithnall/http-wakeup
flatpak-utils-http: Ensure to wake up the main context on error
2021-10-26 17:37:17 -07:00
Philip Withnall
8ff02c0e5b flatpak-utils-http: Ensure to wake up the main context on error
All the other code paths which set `data->done` or `data->error` ensure
to wake up the main context so its loop exit conditions can be checked
again — this code path was missing a wakeup though.

Spotted by code inspection; I haven’t hit this in the wild.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-10-26 23:24:52 +01:00
Anders Jonsson
a9921eae9e Update Swedish translation 2021-10-26 21:24:36 +02:00
Phaedrus Leeds
d870def5aa Merge pull request #4505 from smcv/seccomp-test-coverage
Add test coverage for our seccomp filter
2021-10-26 12:19:55 -07:00
Simon McVittie
7c5aec474c tests: Add basic test coverage for our seccomp filters
In particular, this checks that CVE-2017-5226, CVE-2019-10063 and
CVE-2021-41133 are still prevented.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-25 23:33:46 +01:00
Simon McVittie
4ce251882c tests: Add try-syscall helper
This exercises various syscalls. It's heavily based on the one from
<https://github.com/containers/bubblewrap/pull/459>, but with the
addition of a mode to output the numeric values of various expected
errno codes, which are not otherwise available to shell scripts.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-25 23:32:00 +01:00
Phaedrus Leeds
2181f4f171 .gitignore: Update for recent changes 2021-10-25 23:30:05 +01:00