Commit Graph
5031 Commits
Author SHA1 Message Date
Alexander Larsson 2bd55552b6 flatpak remote-modify add --filter and --no-filter options
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 9454e2d65e flatpak remote-add add --filter option
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson bbd108ab80 FlatpakDir: Make empty xa.filter mean no filter
This is useful as it allows us to easily disable a filter via
the system helper.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 72a7f8aa4e flatpak remotes - show filter in list
There is an optional filter column, and a flag for filtered remotes in the
default options.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson f82f0f397d flatpak-remote: Add api to get/set the filter path for a remote
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 4f6428af83 appstream: Automatically rewrite appstream xml during deploy if filtering
This means only refs that are allowed will be visible in the deployed
appstream.

This sometimes means we have to uncompress the xml.gz before rewriting
and then re-compressing that.

As a result of this we now always end up with both the compressed and
the uncompressed xml file, whereas we before didn't get an uncompressed
one if the remote was using the old appstream format.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 5b7b77d922 dir: Apply ref filters in list_all_remote_refs() and lookup_ref()
Full names are:
 * flatpak_remote_state_lookup_ref()
 * flatpak_dir_list_all_remote_refs()

This should be enough to not get any stray refs, because due to the
complexities of p2p all accesses go via FlatpakRemoteState.

The one leftover to non-filtered stuff is the appstream file, a later
commit will handle that.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 4ba18ec160 FlatpakRemoteState: Include the active filter in the state
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 41018724b1 FlatpakDir: Read the xa.filter per-remote config option
If this is set to a pathname in the configuration of a remote we load
that file and keep track of it as a filter. No filter is actually applied
yet though.

There is two levels of caching, consecutive lookups of the filter
with less than 500msec between use the previous value. Once its more
that that we stat() the file and compare the mtime, reloading the file
if the mtime changes. We also directly reload the file if the pathname
changes.

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson d45c98c0bd utils: Add flatpak_appstream_xml_filter
This applies a ref filter to an appstreaml xml file

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Alexander Larsson 4b39b5c9c0 utils: Add utils to parse and apply ref filter globs
Filters are specified as a list of
op glob

where op can be allow or deny, and the blogs are partial refs
where * means anything in this part of the ref, and non-specified
trailing parts of the ref matches anything.

By default everything is allowed, but if you specify some
deny rules all that they match is denied, except if there is
an specific allow rule.

Internally this takes all the allow and deny globs and convert
them into two combined regular expressions.

Some examples:
 * - match anything
 app/* - match all apps
 runtime/* - match all runtimes
 app/*/x86_64 - match all x86-64 apps
 app/org.gnome.*/*/stable - match all stable gnome apps
 org.gnome.frogr* - match frogr and extensions

This means you can do a both whitelisting:
 deny *
 allow org.the.good.app*
Or blacklisting:
 deny org.the.bad.app*

Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Simon McVittie e0a149858f Don't leak dbus_session_socket from flatpak_run_add_session_dbus_args
The function was already leaking the result of
extract_unix_path_from_dbus_address() in the case where that call
succeeded. Since commit 0e545799 it would also leak the result of
g_build_filename in the case where it checked $XDG_RUNTIME_DIR/bus.

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

Closes: #2877
Approved by: matthiasclasen
2019-05-03 15:02:57 +00:00
Rafael Fontenelle 0b6051b1f6 Update Brazilian Portuguese translation
Closes: #2878
Approved by: matthiasclasen
2019-05-03 14:42:34 +00:00
Simon McVittie e360005d8b Check for missing sentinels in NULL-terminated varargs
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #2876
Approved by: matthiasclasen
2019-05-02 16:58:36 +00:00
Alexander Larsson bed352bb94 Bump bubblewrap to latest version
Closes: #2875
Approved by: alexlarsson
2019-05-02 11:48:51 +00:00
Simon McVittie 0e5457995a run: Make D-Bus session bus default to $XDG_RUNTIME_DIR/bus
This matches what's now implemented in libdbus, GDBus and sd-bus.
If $DBUS_SESSION_BUS_ADDRESS is unset, check whether $XDG_RUNTIME_DIR/bus
is a socket owned by Flatpak's uid; if it is, use it.

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

Closes: #2874
Approved by: alexlarsson
2019-05-02 06:51:10 +00:00
Simon McVittie 62629b44b8 app, common: Use glnx_readlinkat_malloc()
readlink() and readlinkat() have weird semantics (they return the
number of bytes they would have written if there was enough space,
even if that's larger than the buffer), but glnx_readlinkat_malloc()
takes care to do the right thing in all situations.

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

Closes: #2873
Approved by: matthiasclasen
2019-05-01 16:39:18 +00:00
Simon McVittie 89dc344ccb icon-validator, portal: Guard against overlong symlink targets
If the buffer is too small, readlink() returns the number of bytes that
would have been stored if the buffer had been large enough.

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

Closes: #2873
Approved by: matthiasclasen
2019-05-01 16:39:18 +00:00
Alexander Larsson 26ad9154c3 Add flatpak in docker seccomp profile
This is a docker seccomp profile that allows you to run flatpak
inside a docker container, given some special requirements:

 * The host kernel must support unprivileged user namespaces
   (Supported by e.g. fedora and ubuntu kernels)
 * The seccomp profile must be used
   (--security-opt seccomp=flatpak-docker-seccomp.json)
 * flatpak is run as a reguler user, not root, in the container
 * The full host /proc must be visible in the container
   (-v=/proc:/host/proc)

The last one is a bit weird, but the regular /proc in docker
is mounted with some cover-over mounts, and this makes the kernel
disallow mounting a new procfs for the pid namespace. Adding
in a full copy of the host fs causes this to be allowed.

Closes: #2867
Approved by: alexlarsson
2019-04-30 06:20:56 +00:00
Matthias Clasen 5020790f53 Suppress debug output when completing
Any log output interferes with comletion.
We already refrain from installing our verbose
log handlers in this case, but we are still
vulnerable to GLib default message handling,
e.g. via the G_MESSAGES_DEBUG environment
variable. To avoid that, explicitly install
a message handler that suppresses all output.

Closes: https://github.com/flatpak/flatpak/issues/2860

Closes: #2862
Approved by: alexlarsson
2019-04-29 13:40:44 +00:00
Yuri Chornoivan c3df39a0bd Update Ukrainian translation
Closes: #2865
Approved by: matthiasclasen
2019-04-29 10:51:26 +00:00
Kukuh Syafaat af9aea6e75 Update Indonesian translation
Closes: #2863
Approved by: matthiasclasen
2019-04-29 10:34:25 +00:00
Alexander Larsson 7cde959b4e Update pofiles 1.3.3 2019-04-26 13:55:51 +02:00
Alexander Larsson bb04fb4063 Bump version to 1.3.3 2019-04-26 12:22:24 +02:00
Alexander Larsson 68b4420502 Update NEWS for release 2019-04-26 12:22:08 +02:00
Alexander Larsson 0a66707b00 remote-ls: Add --cached option
This prefers cached data, even if stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson 8057de20a8 remote-info: Add --cached support
This prefers any cached data if available, even if its stale.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson ad11954bf7 lib: Add a flag-using _full version of list/fetch_remote_ref
This adds the flag FLATPAK_QUERY_FLAGS_ONLY_CACHED to use the new
code for this.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson aa24754aa0 FlatpakError: Add more dbus error names
Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson 34f463731d system-helper: respect no-interaction for more methods
Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson 6088c7d0a1 dir: Add support for getting remote state using only caches
If only_cached is TRUE we never do any network i/o, instead
returning ERROR_NOT_CACHED if this is necessary.

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson cf42364e23 dir: Keep track of the cache dir in FlatpakDir
We will need this later

Closes: #2859
Approved by: alexlarsson
2019-04-26 08:00:27 +00:00
Alexander Larsson 9c9efe19e0 tests: Properly pass -y to install
This bug was unearthed when we suddenly started to fail when you
answered no to the prompt.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson 131ba30ea9 cli: Drop unnecessary "something failed" message with --noninteractive
We reported the error already, just report the exit status.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson e3db7a4461 cli: Make FLATPAK_ERROR_ABORTED return a failed exit code.
We now return a NULL error meaning nothing is printed as before
but a FALSE result which means the exist code marks the failure.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson 7eb6467e4d main: Allow flatpak_run() to fail with NULL error
This is very useful for the CLI where you want to fail the operation and
return a failure exit code, but the user actively chose to do so on
a prompt, so you don't need to print out anything.

Semantics are: if return FALSE => print error if non-null, then exit
with failure code.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson c3f2fe3279 install/update: --noninteractive implies --yes
This mostly worked because QuietTransaction doesn't ask anything, but
some early checks in the commands itself only checked opt_yes.

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Alexander Larsson e1f45a3878 Fix install --noninteractive not reporting errors
We need to handle operation_error and report errors, and for
fatal errors remember this and report a failure in run(), because
otherwise it returns ABORTED, which is treated as a failure (because
generally that meant the user chose "no" on some question).

Fixes #2839, #2757

Closes: #2858
Approved by: alexlarsson
2019-04-25 10:01:14 +00:00
Simon McVittie 684b19e719 profile: Only alter XDG_DATA_DIRS if flatpak is still installed
In some OSs, removing a package does not immediately remove its
configuration files in /etc. In particular, `dpkg --remove` or
`apt-get remove` in Debian derivatives leaves configuration files intact
so that the package can be reinstalled later without having to
reconfigure it, with `dpkg --purge` or `apt-get purge` used to remove
the configuration files too.

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

Closes: #2849
Approved by: alexlarsson
2019-04-25 08:12:35 +00:00
Alexander Larsson 68d06f7896 api docs: Mention the umask(022) workaround.
There is no great place for this, but the transaction api is
the primary place affected by this problem so I put the note there.

Closes: #2856
Approved by: alexlarsson
2019-04-25 07:13:58 +00:00
Alexander Larsson 76898c4309 Enforce a more permissive umask
We enforce an umask of 022 (no world/group writable) in the cli and
the system helper. This is necessary, because we need to create
ostree repositories shared between the helper and the client, and
a more strict umask breaks this.

It would be nice if we could just set this in a thread-local way when
needed, but unfortunately umask() is not threadsafe or overridable in
any local way.

This unfortunately means this it will not automatically work for
libflatpak users...

Closes: #2856
Approved by: alexlarsson
2019-04-25 07:13:58 +00:00
Alexander Larsson 9c2176e824 dir: Only reuse system cache dirs with permissions 0755
We need this to ensure that the dir can be shared with the new
system-helper flatpak user. Old dirs can happen to get less
permissions if there was a umask set when it was created.

Closes: #2856
Approved by: alexlarsson
2019-04-25 07:13:58 +00:00
Alexander Larsson 3b060d6082 manpages: Add the new name column
Closes: #2852
Approved by: alexlarsson
2019-04-24 13:31:35 +00:00
Alexander Larsson 2ee4b87c55 remote-ls: Only show the origin column if non-unique
Most of the time it is the same because you specified the remote in
the command anyway.

Closes: #2852
Approved by: alexlarsson
2019-04-24 13:31:35 +00:00
Alexander Larsson c84db7714e list/remote-ls/search: Split description field
Instead of combining name and comment we split them into two columns.
We also disable the comment column by default for list and remote-ls
as it is very poor in long tables. However, it is still there for search
where it seems more useful.

Also, the Application column title changed to Application ID to make
it clearer what it is compared to the "Name" column.

Closes: #2852
Approved by: alexlarsson
2019-04-24 13:31:35 +00:00
Matthew Leeds bd18eab6ce create-usb: Delete local repo summary if it exists
Old versions of the create-usb command created a summary file in the
local repo being pulled from (e.g. /var/lib/flatpak/repo) but this
summary generation turned out not to be necessary and was removed. So
any computer which used the create-usb command before commit 7c5751a4f
will have a leftover /var/lib/flatpak/repo/summary file which becomes
outdated as apps are updated and installed. This causes problems for the
next invocation of (a recent version of) the create-usb command which
will use the outdated summary during the pull and fail with an error
message like:

error: Importing 3b1293596e9aa67f6fd0daeae477cb94603a4e8ca9e825f446d3dd04a2b5d5ec.commit:
fstatat(3b/1293596e9aa67f6fd0daeae477cb94603a4e8ca9e825f446d3dd04a2b5d5ec.commit): No such file or directory

So this commit makes the create-usb command delete the summary if it
exists before pulling onto the repo on the USB drive. This means USB
copies will work again for any users that used the USB app copy feature
in Endless OS 3.4.7.

Closes: #2854
Approved by: alexlarsson
2019-04-24 13:28:21 +00:00
Alexander Larsson 0b05a502a7 remote-ls: Don't list eol:ed app unless -a
Closes: #2853
Approved by: matthiasclasen
2019-04-23 16:07:13 +00:00
Alexander Larsson 5abe002f25 list: Skip origin column if all origins are the same
Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Alexander Larsson 277a443744 list: Skip arch column if all arches are the same
Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00
Alexander Larsson 05ac7f4833 CLI: Add skip_unique_if_default to Column
Additionally flatpak_table_printer_set_columns now takes a boolean
to say whether the arguments in use are the default.

Closes: #2850
Approved by: matthiasclasen
2019-04-23 13:05:14 +00:00