Commit Graph

6696 Commits

Author SHA1 Message Date
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
Phaedrus Leeds
71a09d47d5 doc/flatpakrepo: Fix a typo 2021-10-25 14:10:43 -07:00
Phaedrus Leeds
01c2b79ad0 Merge pull request #4501 from gasinvein/build-init-sdk-ext-arch
build-init: Use SDK arch for SDK extensions...
2021-10-25 10:39:19 -07:00
Phaedrus Leeds
2ae3631fc2 Merge pull request #4504 from smcv/regen-test-matrix
tests: Generate Makefile-test-matrix.am.inc in $(srcdir)
2021-10-22 18:37:05 -07:00
Phaedrus Leeds
93d3cb4704 Pedantic typo fix 2021-10-21 17:30:01 -07:00
Phaedrus Leeds
df3d85e753 testlibrary: Add test for remote nodeps option
Always good to expand the test coverage
2021-10-21 11:32:05 -07:00
Phaedrus Leeds
6de22f0e62 Include extensions in listing origin remote refs
In a recent commit I changed flatpak_dir_list_remote_refs() to make main
refs (xa.main-ref) visible for noenumerate remotes (xa.noenumerate),
meaning that an origin remote created for a flatpakref file can be used
to get information about the ref from the file even before it is
installed. This commit extends that work to include extensions of the
main ref, and updates the unit test to check for this. The reasoning is
that if GNOME Software wants to show the user information about, say,
VLC from a flatpakref file before installing it, Software would want to
also show the available plugins so the user can decide if they want to
install those as well. I haven't checked if Software actually does that;
I'm only focusing on making libflatpak do the right thing.
2021-10-21 11:32:05 -07:00
Phaedrus Leeds
7f3556d92c Fix implementation of xa.noenumerate remote option
Currently the xa.noenumerate option on a remote is documented as causing
the remote not to be used when presenting available apps/runtimes or
when searching for dependencies. The idea is that the remote is only
used for providing updates for things installed from it, and this
functionality is used when creating an origin remote for something
installed via a flatpakref file.

However, the implementation of this in flatpak_dir_list_remote_refs() is
buggy. It returns an empty set of refs even if something is both locally
installed and available from the remote. This is because it is using
hash table comparisons of FlatpkDecomposed objects (via
flatpak_decomposed_hash()) which take into account both the ref (or
refspec) and the collection ID, and the local refs' FlatpakDecomposed
objects are created from a refspec whereas the remote refs'
FlatpakDecomposed objects are created from a ref alone. We could fix
this by having them both use refspecs, but it is better to use a
collection-ref tuple for the following reasons:
(1) Changing flatpak_dir_list_all_remote_refs() to use a refspec to
create the FlatpakDecomposed objects would be a breaking change for the
other users of that function.
(2) Both the local and remote refs are from the same remote so we don't
need to use the remote name to disambiguate them, even if no collection
ID is configured.
(3) The whole point of collection IDs is to make refs uniquely
identifiable, so we're using them for the intended purpose.

In addition to fixing this bug, this commit adds a unit test in
testlibrary.c so it stays fixed.
2021-10-21 11:32:05 -07:00
Phaedrus Leeds
ef05925700 dir: Don't mask the main ref of a noenumerate remote
When we create origin remotes for apps installed via .flatpakref files,
we set xa.noenumerate=true and
xa.main-ref=app/com.example.App/arch/branch so that the remote is only
used for the app it was intended for. This is implemented in
flatpak_dir_list_remote_refs() by only listing refs in the remote which
are already installed. This works fine after the ref is installed but in
the short timespan between when the origin remote is created and the app
is installed from it, it means that the remote appears as empty.

The use case where I ran into this is in attempting to use
flatpak_installation_fetch_remote_ref_sync() in the gnome-software
flatpak plugin, in the handling of flatpakref files, which is intended
to just display information to the user and let them decide whether to
install the app. But I was not able to create a FlatpakRemoteRef due to
the behavior described above; see #4453 for more details.

So, change the behavior so that the main ref for an origin remote is
visible even before it is installed. This technically could be a
breaking change for some consumer of libflatpak but that seems very
unlikely, and the new behavior makes more sense.

Also add a unit test for this behavior.
2021-10-21 11:32:05 -07:00