Commit Graph

1279 Commits

Author SHA1 Message Date
Alexander Larsson
976c88cf56 oci: Pass down token into OCI http operations
This is needed for pull operations to actually use the token if one
is given by an authenticator.
2019-12-12 12:16:53 +01:00
Matthias Clasen
54b5e39a96 permission-set: Auto-apply wrapping for data
It is confusing if we explicitly have to specify
the <> GVariant wrapping with --data, but
flatpak permissions strips it when displaying the
result.

Make it transparent by auto-applying the wrapping,
so what you need to pass to --data is the same
as what flatpak permissions shows you.
2019-12-12 09:08:07 +01:00
Matthias Clasen
6f8dc02bca permissions: Don't skip 'empty' rows
Don't skip entries that have no permissions.

I was wasting some time to track down why my
permission-set --data command wasn't working,
when in reality, the permissions command was
just not listing the entries I was adding :(
2019-12-11 17:21:36 +01:00
Matthias Clasen
cdf3c33293 permission-set: Add an option to set data
This is useful for debugging permission store functionality
and will be more so when the openuri portal starts using
per-entry data.
2019-12-11 17:21:36 +01:00
Matthew Leeds
0ab953a2f9 enter: Fix invalid arg error message
I think this was mistakenly changed in commit 4718bcccf.
2019-12-10 14:36:58 +01:00
Philip Chimento
923beec024 Change "update-frequency" to "update-interval"
An event happens more often as its frequency gets higher, so these
values were confusing me.

Rename the constants to include their unit (ms) as well, to avoid
confusion.

Anything that affects public API (such as
flatpak_transaction_progress_set_update_frequency()) or libostree's
options passed to ostree_repo_pull_with_options(), is left as is.
2019-12-06 13:26:49 -08:00
Matthias Clasen
5ec73b9a9a ps: Allow showing compositor info
Show active and background state, based on information obtained
from the background portal backend about which apps have (active) windows.

This currently tries all known portal backends in turn. It might
be nicer to have a portal frontend api to query this, or to find
out which backend to talk to.
2019-12-04 13:33:52 +01:00
Matthias Clasen
653fce251f cli: Don't use \r in plain output
These show up as ^M in test logs, and that is irritating.
Just use \n when producing plain output.

Closes: https://github.com/flatpak/flatpak/issues/3226
2019-12-04 13:30:13 +01:00
Matthias Clasen
4765a78a87 Merge pull request #3270 from matthiasclasen/parent-pid-docs
run: Improve help output for --parent-pid
2019-12-02 07:28:28 -05:00
Matthias Clasen
b76a1bd0df Merge pull request #3265 from matthiasclasen/ps-instance
ps: Don't hardcode instance column
2019-12-02 07:27:23 -05:00
Matthias Clasen
4201a35081 Merge pull request #3266 from matthiasclasen/fail-message-period
Error message cosmetics
2019-12-02 07:26:41 -05:00
Matthias Clasen
76d23cca15 enter: Correct the help output
The COMMAND is not optional, so don't put it in brackets.

Closes: https://github.com/flatpak/flatpak/issues/2881
2019-12-01 23:14:27 -05:00
Matthias Clasen
cb2cadb3ad run: Improve help output for --parent-pid
Show a placeholder to indicate that this option
takes an argument. Update docs to match.
2019-12-01 16:12:36 -05:00
Matthias Clasen
35f023e2d0 build-commit-from: No period for error messages
We don't use periods at the end of error messages
elsewhere, and it looks wrong.
2019-12-01 09:47:53 -05:00
Matthias Clasen
0460d486a9 kill: No period for error messages
We don't use periods at the end of error messages
elsewhere, and it looks wrong.
2019-12-01 09:46:34 -05:00
Matthias Clasen
90c2d24127 ps: Don't hardcode instance column
We were unconditionally adding the instance column,
which causes table headers to be off-by-one when
instance is not among the requested columns.

Change things to only add the instance column
when requested.
2019-12-01 09:39:46 -05:00
Alexander Larsson
ae50843851 portal: Add EXPOSE_PIDS flag
This uses the new bwrap feature via flatpak run --parent-expose-pids to
make new new sandbox pid namespace be a child of the callers sandbox.

Pretty obvious, the only weird thing is that we can't get the peer pid
directly from the caller (as it goes via the dbus proxy) so we have
to look that up from the instance data.
2019-11-27 14:21:25 +01:00
Alexander Larsson
62797b4be9 flatpak run: Add --parent-pid=$pid --parent-expose-pids
Given the pid of an existing flatpak process, if --parent-expose-pids is
specified, the new sandbox is run such that its processes are visible in
the specified sandbox.

In all other senses the two are disjoint though. The new sandbox is
still isolated from the host and the existing sandbox.
2019-11-27 14:21:25 +01:00
Alexander Larsson
f420fad6a9 cli transaction: Handle webflow signals
This shows the url in the default browser. Currenly it just looks
at $BROWSER and falls back to xdg-open.
2019-11-26 16:37:01 +01:00
Alexander Larsson
8d02d86463 add/modify-remote: Add options to set authenticator options 2019-11-26 16:37:01 +01:00
Alexander Larsson
077006ecc8 Add token-type per-commit metadata key and export it to summary
We store this in the sparse cache, because we don't expect it to be
set for everything.
2019-11-26 16:37:01 +01:00
Alexander Larsson
e2379d20e2 Optionally return commit id in flatpak_remote_state_lookup_cache
This will only work if xa.commits is in the metadata, which is only
available in the p2p case and was only added recently.
2019-11-26 16:37:01 +01:00
Alexander Larsson
3c74199549 Print errors on stderr in install/update
If we're not doing fancy ui, print errors on stderr. This was biting me
in some tests where I'd like to grep for some strings in the stderr
output.
2019-11-26 16:37:01 +01:00
Alexander Larsson
2db1c6e6c4 Add defines for existing summary sparse cache keys
These are explicitly made short to save space, so lets have defines
for them to make sure we don't mistype them, especially as we
will be adding new keys.
2019-11-26 16:37:01 +01:00
Alexander Larsson
8cc737466f run: Allow overriding no-a11y/dbus for sandboxed runs 2019-11-26 09:52:07 +01:00
Alexander Larsson
66b2621297 run: Clean up code that sets flags
No changes, just make the code easier to read by using ifs
instead of a bunch of ?: ops.
2019-11-26 09:52:07 +01:00
Matthias Clasen
c503307ae0 Use DeletePermission when available
This avoids a racy client-side implementation.
2019-11-22 16:35:43 +01:00
Matthias Clasen
bb5b2de3f1 install: Always show the op column
Otherwise, it is not clear what changes the question below
the table refers to.

Fixes: https://github.com/flatpak/flatpak/issues/3075
2019-11-21 13:49:30 +01:00
Matthias Clasen
c917257a1c permission-remove: Allow removing a single row
Allow specifying an app-id to remove from a given
id in a given table.
2019-11-21 13:48:31 +01:00
Matthias Clasen
5a8489cefe Add a permission-set command
This command adds permissions for an app to one of the permission
store database(s).
2019-11-21 13:48:31 +01:00
Alexander Larsson
4718bcccfd enter: Make sure sudo -E works when using setuid brwap
This also updates the manpage so it is correct wrt permissions and
sudo.
2019-11-20 13:17:43 +01:00
Alexander Larsson
6d68094879 enter: Better error values if enter is not supported on your kernel 2019-11-20 13:17:43 +01:00
Alexander Larsson
a094aa0040 enter: Add comment about why NS_GET_USERNS ioctl is not used 2019-11-20 13:17:43 +01:00
Alexander Larsson
47e2718833 enter: Clean up namespace equality checks
There is no need to read the links, just look at the inode nr
which is the same info, and that also works on the bind-mounted
.userns thing where readlink fails.

Also, don't fail for non-existing namespaces.
2019-11-20 13:17:43 +01:00
Alexander Larsson
a0cb7f6964 enter: No need to fail if a pid is specified that it is not the primary pid.
We can enter from any pid in the sandbox.
2019-11-20 13:17:43 +01:00
Alexander Larsson
f568a068c6 enter: Support non-root flatpak enter
Assuming unprivileged namespaces works we can now user the .userns
bindmount to access the intermediate bubblewrap user namespace.

This also drops the warning about root, and make sure we drop all caps
at the end.
2019-11-20 13:17:43 +01:00
Alexander Larsson
e16b40dfec enter: Use the correct pid (child pid) as the target for entering
This is the one in a namespace, the other one is just the wrapper.
2019-11-20 13:17:43 +01:00
Alexander Larsson
180494ca41 run: Don't install polkit agent for enter/run/build
Neither of these ever need a polkit agent, and run/build are somewhat
performance sensitive and we don't want to connect to dbus unnecessarily.
For enter this is critical though, as the dbus connection starts a thread
which is not compatible with the setns syscall.
2019-11-20 13:17:43 +01:00
Matthew Leeds
eabc52456a Clean up duplicated mirror refs
Due to bug #3215 some systems have refs in refs/mirrors/ in addition to
the usual refs/remotes/ location. The remote refs are always at least as
new as the mirror ones since the repo_pull() invocation in
flatpak_dir_pull() which does not use OSTREE_PULL_FLAGS_MIRROR happened
after the one that did. Cleaning up these mirror refs is important since
otherwise when the remote ref is either updated or removed (by an
uninstall) disk space will be leaked since the mirror ref will point to
a no longer needed commit.

So, remove (almost) all mirror refs during flatpak repair, uninstall,
or update operations. And for the uninstall and update operations do it
in FlatpakDir so that it happens regardless of if the CLI of libflatpak
are used.

Also, add a unit test for this.

Fixes https://github.com/flatpak/flatpak/issues/3222
2019-11-20 13:17:27 +01:00
Matthew Leeds
2342a7d4be app/flatpak-quiet-transaction: Use "in favor of" phrasing
In commit 0772ab6c9 we changed "in preference of" to "in favor of" in an
informational message produced by FlatpakCliTransaction for clarity. Do
the same for FlatpakQuietTransaction.
2019-11-18 15:07:01 -08:00
Matthew Leeds
547443b13d Merge pull request #3185 from georgelemental/patch-1
Make deprecation warning notice less confusing
2019-11-01 21:45:14 -07:00
Georgelemental
0772ab6c9f Make deprecation warning notice less confusing
Replace "in preference of" with "in favor of," as the former is not
widely used, but the latter is.

This problem was mentioned in issue #3139.
2019-11-01 23:49:45 -04:00
Matthias Clasen
0df03adbb7 Merge pull request #3203 from wjt/flatpak-remote-ls-app-runtime
builtins: hide runtimes with [list|remote-ls] --app-runtime
2019-10-30 13:11:04 -04:00
Will Thompson
e282cd98d2 builtins: hide runtimes with [list|remote-ls] --app-runtime
Currently, if you run:

    flatpak remote-ls flathub --app-runtime=com.endlessm.Platform//eos3.2

you see no apps (correct) but hundreds of runtimes. This is inconsistent
with the documentation for the '--app-runtime' option, which says:

> List applications that use the given runtime

To fix this, default to not showing runtimes if '--app-runtime' is
given. This is consistent with the behaviour if just '--app' is
specified. If you run 'flatpak list --app-runtime=com.example.Foo
--runtime' then you get apps using that runtime, plus all other
runtimes, which seems fair enough to me.
2019-10-29 17:44:16 +00:00
Philip Withnall
cc7474d0e9 config: Rework handling of extra-languages to change locale format
Accept the locale format as documented by `setlocale(3)`, rather than
another arbitrary format.

This reworks the validation code, and was tested to accept all the
locales on my F30 system using:
```
flatpak config --user --set extra-languages $(locale -a | tr -s '\n' ';' | head -c -1)
```

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-24 13:54:05 +01:00
Philip Withnall
a3a7f3214c config: Accept bokmal as a language
It’s listed in `locale -a` output, even though it should canonically be
represented as `nb`.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-24 13:54:05 +01:00
Philip Withnall
e78a53fede config: Accept C and POSIX as languages
They are listed as languages in `locale -a` output.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-24 13:54:05 +01:00
Mazen Asef
65912f27fe app: Allow locales to be stored in the extra-languages key
In order to configure gnome-software to show specific apps in one region
without showing to all language speakers, we allow the storage of full
locales on the extra-languages key. However, these locales are ignored when
calling flatpak_installation_get_default_languages, so locales will be reduced
to their language identifier (eg. en_IN locale will be returned as 'en', and
az_Latn_AZ will be returned as 'az'). In order to get the full locales, we can
call flatpak_installation_get_default_locales instead, which can return languages
and locales.
2019-10-16 16:25:06 -03:00
Matthias Clasen
ea8ecdbeb9 eol: Use the right ref in the confirmation message
We were using the old ref here, instead of the new
one, when asking whether to go ahead.

Closes: https://github.com/flatpak/flatpak/issues/3139
2019-10-02 14:56:44 +02:00
Alexander Larsson
178845d6d6 mask: Support masking of updates
In addition to just masking auto-downloads, masking now also means
pinning of the currently installed version of an already installed ref.
2019-09-30 10:52:06 +02:00