Commit Graph

7164 Commits

Author SHA1 Message Date
Matthias Clasen
d13211f5e6 Merge pull request #2434 from matthiasclasen/compiler-warning
Silence compiler warnings
2018-12-15 09:12:00 -05:00
Matthias Clasen
0261fb5d38 Silence compiler warnings
clang was complaining about a number of unused
variables in testlibrary.c. Drop them
2018-12-14 20:56:52 -05:00
Matthias Clasen
11a9bef97e Merge pull request #2432 from aleixpol/clangbuild
Fix build with clang
2018-12-14 15:55:51 -05:00
Matthias Clasen
041c99d834 Merge pull request #2431 from aleixpol/master
Don't use the last percentage if the total size changed
2018-12-14 13:35:59 -05:00
Aleix Pol
192066517c Fix build with clang
Fixes #2430
2018-12-14 18:50:05 +01:00
Aleix Pol
b6eddbccff Don't use the last percentage if the total size changed
It happens sometimes that the first processed total is 1, when this gets
downloaded we have 100% already and then the total changes making this
percentage faulty.
This makes the progress regress sometimes, but I'd say it's better than
a permanent, ficticious number.

Fixes #2428
2018-12-14 18:27:17 +01:00
Matthias Clasen
06019e357d Merge pull request #2427 from matthiasclasen/wording-tweak
Revise some strings slightly
2018-12-13 00:28:59 -05:00
Matthias Clasen
0a7fc79647 Revise some strings slightly
This reads better when seen in action.
2018-12-12 23:53:45 -05:00
Matthew Leeds
fa9225344e app: Make single-choice prompts friendlier
When we're prompting the user to choose between a list of items but
there's only one item, use a yes/no prompt and different wording.

Closes: #2426
Approved by: matthiasclasen
2018-12-13 04:30:48 +00:00
Matthias Clasen
df5b705941 Merge pull request #2419 from matthiasclasen/env-docs
doc: Mention xdg vars
2018-12-12 16:15:41 -05:00
Simon McVittie
4c92f5e3c1 testlibrary: Don't leak source IDs
This avoids a crash or deadlock if the timeout is reached during test
teardown, after the GMainLoop has already been freed. That appears to
be more likely to happen when run as an installed-test.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/flatpak/flatpak/issues/2422

Closes: #2425
Approved by: matthiasclasen
2018-12-12 18:39:12 +00:00
Alexander Larsson
90dad12697 build-update-repo: Add --static-delta-jobs option
We ran into some issues on flathub where a build with very large
files caused the parallel delta generation to use a lot of paging,
essentially blocking progress. This option can at least allow you
to make progress in that case, although we should ideally have
a better solution.

Closes: #2416
Approved by: alexlarsson
2018-12-12 16:15:16 +00:00
Matthew Leeds
aa19b18ee0 fixup! doc: Mention xdg vars 2018-12-11 21:32:00 -08:00
Matthias Clasen
f3748affc4 doc: Mention xdg vars
When I made the list of overridden environment variables,
I forgot the 3 most important ones, XDG_{DATA,CACHE,CONFIG}_HOME.
2018-12-11 23:36:19 -05:00
Simon McVittie
4111dbadaf session-helper: Don't crash on NameOwnerChanged
There was a typo here: (gpointer *) pid_data should have been
(gpointer *) &pid_data, so that g_hash_table_iter_next() would make
pid_data a pointer to a PidData struct. Instead, the previous
implementation left pid_data set to NULL, leading to a NULL dereference
and segmentation fault whenever a name fell off the bus while a watched
client existed.

Instead of directly inserting the missing "&", I've used a pattern
that avoids needing the cast, in an attempt to make it more obviously
correct.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2417
Approved by: matthiasclasen
2018-12-11 15:43:37 +00:00
Matthew Leeds
5a7d13399f app: Avoid a critical libpolkit error
Currently the flatpak install command reliably produces this error:

** (flatpak:21996): CRITICAL **: 22:38:52.472: polkit_unix_process_set_property: assertion 'val != -1' failed

This is caused by a recent patch to polkit[1] to address CVE-2018-19788,
which apparently means you can't pass -1 to
polkit_unix_process_new_for_owner() for the uid. So change Flatpak to
pass the actual UID instead.

[1] 2cb40c4d5f

Closes: #2414
Approved by: alexlarsson
2018-12-11 10:45:39 +00:00
Matthew Leeds
6e42104020 system-helper: Fix an outdated comment 2018-12-10 22:04:37 -08:00
Alexander Larsson
d39660da32 Update pofiles for release 1.1.1 2018-12-10 14:05:04 +01:00
Alexander Larsson
9d8216ece2 Fix memleak in flatpak_bwrap_bundle_args 2018-12-10 13:53:08 +01:00
Alexander Larsson
45171e0ab0 Fix memleak in get_locale_langs_from_accounts_dbus 2018-12-10 13:52:54 +01:00
Alexander Larsson
2248ced6f2 info: Fix memleak 2018-12-10 13:52:39 +01:00
Alexander Larsson
ddbc5266b8 Fix leak in build-finish
We already found the deploy_dir, no need to do it again.
2018-12-10 11:51:38 +01:00
Alexander Larsson
426eae070f install: Fix leak
When updating dir, free the old default value.
2018-12-10 11:51:11 +01:00
Alexander Larsson
bfa9fabd52 Fix leak in flatpak_get_current_locale_langs() 2018-12-10 11:50:55 +01:00
Alexander Larsson
c7c824bc5c tests: Add suppression for polkit-agent leak 2018-12-10 11:50:35 +01:00
Alexander Larsson
fc828911f5 Update NEWS for 1.1.1 2018-12-10 11:18:12 +01:00
Alexander Larsson
6b1acf9029 Bump version to 1.1.1 2018-12-10 11:18:03 +01:00
Matthias Clasen
a8dff96aeb Add some docs for the overall git repo layout
Trying to make things less confusing.

Closes: #2404
Approved by: alexlarsson
2018-12-10 07:26:51 +00:00
Matthias Clasen
d613bc0532 Minor revisions of flatpak(1)
Capitalize Flatpak in text, add a paragraph about building
that references flatpak-builder, and add a reference to
www.flatpak.org.

Closes: #2410
Approved by: alexlarsson
2018-12-10 07:15:12 +00:00
Matthew Leeds
3c43771d06 system-helper: Fix a seg fault on Deploy
The first element put in the variant created by
flatpak_dir_system_helper_call_deploy() is the repo path, but this is
being treated as the installation ID in
flatpak_authorize_method_handler(), which results in a seg fault when
dir_get_system() returns NULL and this NULL is passed to
dir_ref_is_installed(). Fix the seg fault by getting the correct element
from the variant.

Closes: #2411
Approved by: matthiasclasen
2018-12-09 07:09:49 +00:00
Matthew Leeds
2f00156704 app: Fix support for "NAME BRANCH" syntax
The uninstall command supports the syntax "flatpak uninstall
org.gnome.Builder stable" as an alternative to "flatpak uninstall
org.gnome.Builder//stable", but this support was broken by the fuzzy
matching (partial ref) feature. Since that syntax only supported full
app IDs not partial ones, assume it's being used if the first argument
is a full app ID and the second argument looks like a branch. This means
we don't support the syntax "flatpak uninstall builder stable" (unless
you're trying to uninstall an app called stable).

Similarly, fix the install command's support for the syntax "flatpak
install flathub org.gnome.Builder stable".

Also, add a unit test for both of the above.

Fixes https://github.com/flatpak/flatpak/issues/2395

Closes: #2405
Approved by: matthiasclasen
2018-12-08 00:56:30 +00:00
Alexander Larsson
185fe43fb7 extra_data: In system-helper case, canonicalize uid/gid
Make sure all files produced by apply_extra are owned by root.

Closes: #2398
Approved by: matthiasclasen
2018-12-07 20:38:45 +00:00
Matthew Leeds
7fb5f2a33e app: Fix compiler errors with old libpolkit
Make sure we have g_autoptr support for libpolkit types even if we're
compiling against an old version of libpolkit, the same way we do in
system-helper/flatpak-system-helper.c.

Fixes https://github.com/flatpak/flatpak/issues/2401

Closes: #2403
Approved by: matthiasclasen
2018-12-07 20:37:11 +00:00
Matthias Clasen
9826622f6e Fix a policy mismatch
We added metadata-update to the PolicyKit policy,
but made the system-helper user update-metadata.
Oops

Closes: #2399
Approved by: mwleeds
2018-12-07 20:05:44 +00:00
Matthias Clasen
4fe9fbe2be system-helper: Strip polkit errors before sending them on
We shouldn't put the unsightly dbus error wrapping in the
UI. The cient already strips the wrapping from the system
helper call, but it can't strip the second level itself.

Closes: #2399
Approved by: mwleeds
2018-12-07 20:05:44 +00:00
Matthias Clasen
43d4fb6a3e Fix oci pull progress reporting
Comparing the code in flatpak-utils.c:progress_cb,
we need to set bytes-transferred for the total amount
of data that has been transferred so far. The value
we were setting so far, fetched-delta-part-size, refers
to the size of the objects we already have locally, and
is subtracted from the total, which explains oci progress
running backwards.

Closes: #2392

Closes: #2400
Approved by: matthiasclasen
2018-12-07 19:51:11 +00:00
Alexander Larsson
682a93646d tests: Use g_test_dbus in testlibrary
This means we pick up the built services. Also we set
FLATPAK_SYSTEM_HELPER_ON_SESSION so that the system-helper
runs on the session-bus just like in libtest.sh.

Closes: #2397
Approved by: matthiasclasen
2018-12-07 14:45:31 +00:00
Alexander Larsson
b7349aa91a Fix build with --disable-system-helper
Skip the custom polkit code then.

Closes: #2394
Approved by: alexlarsson
2018-12-07 08:21:52 +00:00
Matthias Clasen
86c10e36df Fix a parameter type mismatch
GVariant doesn't take it lightly when you are trying to extract
an ay value with an s format. This was causing critical warnings.

Closes: #2393
Approved by: alexlarsson
2018-12-07 08:01:36 +00:00
Matthew Leeds
35d0d9a246 update: Update custom installations too
Currently the update command only checks the default system and user
installations (unless overridden by a command line flag). This commit
makes it check custom installations as well, so they are not left out.

Care is taken so that an empty or broken installation doesn't cause the
whole update operation to fail.

Fixes https://github.com/flatpak/flatpak/issues/2006

Closes: #2345
Approved by: matthiasclasen
2018-12-06 22:48:42 +00:00
Matthew Leeds
7b77782b0e app: Correct default dir in the ALL_DIRS case
Some commands depend on the first directory in the list returned by
flatpak_option_context_parse() being the default system directory, which
is true for FLATPAK_BUILTIN_FLAG_STANDARD_DIRS. This commit makes the
system directory first for FLATPAK_BUILTIN_FLAG_ALL_DIRS as well, in
case any code in the future uses that flag in combination with that
assumption.

There is one user of the ALL_DIRS flag that actually wants to keep the
user directory first in the list, the run command. This is so that a
user-installed app will be run even if the same app is installed
system-wide. So this commit modifies the run command to undo this
change after calling flatpak_option_context_parse().

Closes: #2345
Approved by: matthiasclasen
2018-12-06 22:48:42 +00:00
Matthias Clasen
efa901ff39 Disable PolicyKit dialogs for --assumeyes
The flag is really meant to disable all interaction,
and this includes PolicyKit dialogs.

Closes: #2389
Approved by: alexlarsson
2018-12-06 15:24:35 +00:00
Matthias Clasen
b8cad064eb Add our own polkit listener implementation
This lets us respect the fancy output setting, and
it lets us do some other things that make it better
integrated.

Closes: #2379
Approved by: alexlarsson
2018-12-06 15:01:14 +00:00
Matthias Clasen
6d95383050 cli transaction: Improve progress handling
Arrange for progress to be done before we
ask for polkit auth, so we don't end up with
the text prompt mushed into the progress display.

Closes: #2379
Approved by: alexlarsson
2018-12-06 15:01:14 +00:00
Matthias Clasen
d44eb141c1 cli: Work on the console
Install a polkit text agent that can ask for
authorization when we are on the console.

This brings us closer to best practice for polkit use.

Closes: #2379
Approved by: alexlarsson
2018-12-06 15:01:14 +00:00
Matthias Clasen
e14af35207 system-helper: Centralize pid-setting
There was a bunch of handle methods which forgot to do
this manually, so call the flatpak_dir_set_source_pid()
method right when we create the FlatpakDir object.

Closes: #2384
Approved by: alexlarsson
2018-12-06 14:47:58 +00:00
Matthias Clasen
c685f05f8a trivial: Fix a gtk-doc warning
gtk-doc complains if parameter names don't match between
headers and doc comments, so make them match, for a quieter build.

Closes: #2384
Approved by: alexlarsson
2018-12-06 14:47:58 +00:00
Matthias Clasen
2089701206 system helper: Don't rely on the caller for updates
The Deploy method takes an 'update' flag from the caller
and picked the permission to check based on that, which
is not safe. Instead, we can check ourselves if the ref
we are given is already installed (in which case it is
an update, or a reinstall).

After this change, the update flag is ignored by the
system helper.

Closes: #2384
Approved by: alexlarsson
2018-12-06 14:47:58 +00:00
Matthias Clasen
21f845c1a7 Revise polkit messages again
I realized that these messages are a bit confusing, with
keep permissions and implications. We end up asking a
question about one ref, but then use the permission we optained
to operate on other refs. This will get a bit worse with
the new hints, so go back to more generic messages that
don't talk about the details. The ultimate goal here is
less messages, anyway.

Closes: #2384
Approved by: alexlarsson
2018-12-06 14:47:58 +00:00
Matthias Clasen
a2f57f64fd Add flags that allow to 'upgrade' permissions
This is to avoid multiple polkit dialogs, regardless
of transaction ordering.

FlatpakTransaction calculates the 'strongest' op it has,
and passes the hints accordingly. FlatpakInstallation
doesn't pass hints, since it does individual operations.

The system helper uses the hints to determine which PolicyKit
permission to request. Since the policy typically has 'keep'
set, this mean that the following operations in the same
transaction will be able to reuse the permission obtained
for the first one.

Closes: #2384
Approved by: alexlarsson
2018-12-06 14:47:57 +00:00