Commit Graph

3182 Commits

Author SHA1 Message Date
Alexander Larsson
9e1e982bf8 Add flatpak config option
This is currenly only used to configure the languages to install.

Closes: #1098
Approved by: alexlarsson
2017-10-11 12:48:07 +00:00
Alexander Larsson
62760761b7 common: Clean up the locale detection
This is mostly a cleanup of some code and extracting common code to
helper functions. But additionally, we switch the xa.languages config
value to be a list of languages, rather than dirs, although for
backwars compat we still support if it specifies dirs.

Closes: #1098
Approved by: alexlarsson
2017-10-11 12:48:07 +00:00
Alexander Larsson
97d6e6a730 flatpakrefs: Don't g_critical if title is not set
The title is optional, so don't set it in the remote if it
is not set.

Closes: #1095
Approved by: alexlarsson
2017-10-10 12:24:18 +00:00
AsciiWolf
f776fd6839 Update Czech translation
Closes: #1094
Approved by: alexlarsson
2017-10-10 06:56:14 +00:00
Piotr Drąg
90d9a230d5 Update Polish translation
Closes: #1093
Approved by: alexlarsson
2017-10-09 15:12:41 +00:00
Alexander Larsson
e7e1331653 Make tests work on debian
The regular ldconfig is some bash wrapper over /sbin/ldconfig.real
2017-10-09 15:45:25 +02:00
Alexander Larsson
d952cdab9b update pofiles 0.9.99 2017-10-09 12:44:15 +02:00
Alexander Larsson
7f41bd7287 Update version to 0.9.99 2017-10-09 12:38:28 +02:00
Alexander Larsson
36735ece0d Update NEWS for release 2017-10-09 12:38:14 +02:00
Alexander Larsson
f0a2766551 Require OSTree 2017.12
This version has an important fix to the pull code that ensures
that all outstanding operations are settled before returning.
This is particularily important for flatpak that can do multiple
flatpak operations in different threads.

Closes: #1092
Approved by: alexlarsson
2017-10-09 10:36:55 +00:00
Alexander Larsson
f6658ad712 Use the new glnx glnx_autofd name for glnx_fd_close
This is a lot clearer

Closes: #1091
Approved by: alexlarsson
2017-10-09 10:19:00 +00:00
Colin Walters
2d32fbe0cb run: Use memfd_create() for data passed to bwrap
Followup to the previous commit to use `O_TMPFILE`, for
the cases here what we really want is to use sealed memfds.  This
ensures the container can't mutate the data we pass.

Now, the args fd I was looking at turned out to be a bwrap bug,
but this is a good example of the mitigation:

```
$ flatpak run --command="/bin/sh"  org.test.Hello
ls -al /proc/$$/fd
total 0
dr-x------. 2 1000 1000  0 Oct  1 16:43 .
dr-xr-xr-x. 9 1000 1000  0 Oct  1 16:43 ..
lrwx------. 1 1000 1000 64 Oct  1 16:43 0 -> /dev/pts/2
lrwx------. 1 1000 1000 64 Oct  1 16:43 1 -> /dev/pts/2
lrwx------. 1 1000 1000 64 Oct  1 16:43 2 -> /dev/pts/2
lrwx------. 1 1000 1000 64 Oct  1 16:43 255 -> /dev/pts/2
lrwx------. 1 1000 1000 64 Oct  1 16:43 9 -> /memfd:bwrap-args (deleted)
org.test.Hello$ echo foo > /proc/self/fd/9
sh: /proc/self/fd/9: Operation not permitted
```

Closes: #1064
Approved by: alexlarsson
2017-10-09 09:53:20 +00:00
Leo Antunes
a623d864f4 Partially revert f1df5cb to fix --persist
We should not check if a persistence target exists outside of the
chroot, since its existance is irrelevant.

Fixes #1088

Closes: #1089
Approved by: alexlarsson
2017-10-09 08:14:05 +00:00
Alexander Larsson
140fee3adf build-finish: Add --extension-priority option (#1084)
* build-finish: Add --extension-priority option

This lets you set the priority of the extension.

* fixup! build-finish: Add --extension-priority option

* fixup! build-finish: Add --extension-priority option
2017-10-06 09:01:18 -07:00
Alexander Larsson
71f7797251 Fix build: ensure we unset O_CLOEXEC on all fds
Also, we need to pass fd_array to flatpak_run_setup_base_argv so
the fds get added.
2017-10-06 14:45:01 +02:00
Alexander Larsson
898e816d17 Don't enable debug output from fuse
Fixes https://github.com/alexlarsson/xdg-document-portal/issues/29

Closes: #1083
Approved by: pwithnall
2017-10-05 21:57:45 +00:00
Colin Walters
4bc46338d9 document-portal: Handle bubblewrap changing to drop /newroot
There's an oustanding bubblewrap PR where we'd like to change how
we set up the rootfs; a side effect of this will be that /newroot
disappears from the `/proc` links:
[bubblewrap pull 172](https://github.com/projectatomic/bubblewrap/pull/172).

I took a stab here at adapting the code to work in both the old and new cases.
Just compile tested at the moment. There's a lot of subtleties in this code; in
particular how we end up mutating-in-place the path buffer and how that
interacts with inspecting it.

Closes: #1063
Approved by: alexlarsson
2017-10-05 16:54:20 +00:00
Colin Walters
0b32f63421 run: Use libglnx more (O_TMPFILE, glnx_loop_write())
In general libglnx has expanded a lot to have a good set of low-level wrappers
for things like writing a buffer to a fd.  Also, we should use `O_TMPFILE`
if available - I think the code reduction speaks for itself here.

Writing this patch as a result of looking at what fds flatpak injects.

However, *really* we want to use sealed memfds.  I'll likely copy the
systemd wrappers for that into libglnx too.

Also, it took me a while to figure out the reason the `--args` code
worked before was because we were leaking the fd.

(Updated by Alexander Larsson <alexl@redhat.com> to use O_TMPFILE
 in more places, like for the seccomp code, and rebased on
 some preparatory cleanups)

Closes: #1060
Approved by: alexlarsson
2017-10-05 16:50:11 +00:00
Alexander Larsson
f4de7fb4dd vlagrind suppression: Ignore FICLONE ioctl confusion 2017-10-05 10:34:48 +02:00
João Paulo Rechi Vita
2663efe7a9 dir: Prefer unmaintained related extensions
If an extension is already installed as an unmainted extension, prefer
it instead of downloading from the remote.

Closes: #1081
Approved by: alexlarsson
2017-10-05 07:37:13 +00:00
Alexander Larsson
f65620ce3b run: Log *all* bwrap arguments
Now that we need -vv to show this we can make it a bit verbose.
This is useful for lowlevel debugging.

Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +00:00
Alexander Larsson
2364d907d9 Make the bubblewrap commandlines only visible in double-verbose
Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +00:00
Alexander Larsson
aec35fd9d9 Make --verbose a counting argument, specify twice for more info
Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +00:00
Alexander Larsson
6c15539f06 Disable verbose when completing
Otherwise the verbose messages break the completion

Closes: #1077
Approved by: alexlarsson
2017-10-05 07:29:31 +00:00
Alexander Larsson
9762990841 Fix the ld.so.conf check
We got the lstat return value check inverted, so we always regenerated
unless there was no ld.so.conf in the runtime, and then it depended
on some random memory.

Closes: #1080
Approved by: alexlarsson
2017-10-04 16:24:58 +00:00
Alexander Larsson
e759819c5d Fix uninitialized variable read if stdout is not a tty
This showed up when running the tests in valgrind, where
ioctl (STDOUT_FILENO, TIOCGWINSZ) fails. We fall back to 80 chars
in this case.

Closes: #1079
Approved by: cgwalters
2017-10-04 15:43:59 +00:00
Alexander Larsson
94682112c5 Fix extension bind order
If an extension has a higher priority than another, but is still
mounted beneath another, then the order of binds need to be different
than the ld order.

For example, in steam we want the 32bit GL extension to override any
GL in the Compat32 extension, but the GL extension needs to be be in
/usr/lib/32bit/lib/GL, whereas the Compat32 extension is in
/usr/lib/32bit.

We handle this by first bind mounting all extensions in place, in
alphabetical path order (i.e. shorter first), and then apply the
ld paths in priority order.

This matches whats described in https://github.com/flatpak/flatpak/issues/1075

Closes: #1076
Approved by: alexlarsson
2017-10-04 15:13:13 +00:00
Alexander Larsson
f7a1c9fe7c LD_LIBRARY_PATH: Fix order of extension libs
We prepend the app extensions, so they are before /app/lib, but
we append the runtime extensions so they are after /app/lib.

This matches what is described in https://github.com/flatpak/flatpak/issues/1075

Closes: #1076
Approved by: alexlarsson
2017-10-04 15:13:13 +00:00
Alexander Larsson
3979cfadd3 run: Use local variable for use_ld_so_cache
This is easier to read than random TRUE/FALSE values, and it makes
it easy to change it when debugging.

Closes: #1076
Approved by: alexlarsson
2017-10-04 15:13:13 +00:00
Alexander Larsson
eaa780ea63 ld.so.cache: Fix order of extension libs
We include the app extension ld.so.conf files before the app
and after that the runtime extension conf files.

This matches what is described in https://github.com/flatpak/flatpak/issues/1075

Closes: #1076
Approved by: alexlarsson
2017-10-04 15:13:13 +00:00
Alexander Larsson
aa28d9c7b4 run: Make extension ld.so.conf files have nicer numbering
We were creating names for all extensions, even those that did
not get a ld.so.conf file created, so the count in was weirdly
inconsistent.

Closes: #1076
Approved by: alexlarsson
2017-10-04 15:13:13 +00:00
Alexander Larsson
129ab559ee Strip some more common environment variables from the host
We strip PYTHONPATH, PERLLIB, PERL5LIB and XCURSOR_PATH from the
environment in the sandbox, because these kind of path variables
can badly affect the sandbox (e.g. pulling in host-side code).

Closes: #1078
Approved by: alexlarsson
2017-10-04 15:12:30 +00:00
Philip Withnall
166a4e144d common: Don’t commit arbitrary files into the ostree-metadata branch
When building the ostree-metadata branch (which only happens when
configured with --enable-p2p), we are supposed to create empty commits
which contain only metadata. However, the code to do this was wrong, and
was instead pulling in all the files from the current working directory
and committing them.

Fix that code to actually create an empty commit.

This could have been a fairly serious bug were it not for the fact that
nobody’s using this code because it’s all experimental.

Spotted as part of https://github.com/ostreedev/ostree/pull/1158.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1066
Approved by: alexlarsson
2017-10-04 12:54:30 +00:00
Piotr Drąg
badf74bdd9 Update Polish translation
Closes: #1061
Approved by: alexlarsson
2017-10-04 12:47:11 +00:00
Matthew Leeds
71f4a87f51 dir: Print debug output when opening flatpak dirs
It's easy to end up with multiple flatpak installations on a system, and
it's not always clear which one(s) flatpak is using. So this commit adds
some debug output in some cases when flatpak opens an installation
directory such as /var/lib/flatpak. This is especially important for
people who build flatpak themselves because if you omit --prefix=/usr
or use --with-system-install-dir your flatpak will look in non-standard
locations like /usr/local/var/lib/flatpak.

If we were to print this every time a flatpak directory is opened, it
would flood the log. So instead add a utility function and use it
strategically. Many flatpak commands will log the directory when they
use flatpak_option_context_parse(), others in
flatpak_find_deploy_for_ref(), and for others the logging has been
added manually.

Closes: #1067
Approved by: alexlarsson
2017-10-04 12:39:43 +00:00
Philip Withnall
6e6354b877 lib/installation: Fix some typos in error message strings
Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1070
Approved by: alexlarsson
2017-10-04 12:32:56 +00:00
Kukuh Syafaat
78df4117b7 Update Indonesian translation
Closes: #1072
Approved by: alexlarsson
2017-10-04 12:25:56 +00:00
Valentin David
845a0b3bf7 Use ld.so.cache instead of LD_LIBRARY_PATH (when not building)
Instead of setting LD_LIBRARY_PATH to make the app load the right
libraries we run ldconfig to generate a ld.so.cache that we feed
to the sandbox as /etc/ld.so.cache. The cache itself is generated
by running ldconfig at run time, but for apps we cache the
result in $HOME/.var/app/$APPID/.ld.so/cache based on the
current app/runtime/extensions commit ids.

We also unset LD_LIBRARY_PATH, to ensure any host-side value
does not mess with the sandbox.

The default ld.so.conf we set (if the runtime has none, or an empty
one) is:

 include /run/flatpak/ld.so.conf.d/*.conf
 include /app/etc/ld.so.conf
 /app/lib

Additionally all the extension points that have add_ld_path set gets a
ld.so.conf snippet in /run/flatpak/ld.so.conf.d.

This allows applications and extensions to install their own paths if
needed, and if the runtime wants more location they can install a
custom ld.so.conf that includes the above.

In the flatpak build case we still use LD_LIBRARY_PATH like before,
because there is no good key (like the commit ids) for keeping the
cache up-to-date. Also, the behaviour is different when building an
app for instance. If /app/lib is not in LD_LIBRARY_PATH then the
sandbox-wide /etc/ld.so.cache must be updated for a newly installed
library to work, but the sandbox is not allowed to update
/etc/ld.so.cache.

This code was originally written by Valentin David <valentin.david@gmail.com>
with changes by Alexander Larsson <alexl@redhat.com>.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
Alexander Larsson
f06cae1556 run: Break out /usr link creation to helper
This is the code needed to set up the symlinks into the runtime
to make stuff work. We will need this separately for minimal runtime
use.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
Alexander Larsson
5cd8db035b common: Add flatpak_switch_symlink_and_remove
This creates a symlink pointing to a target, but if the symlink
already exists, it ensures (atomically) that the previous target
is deleted. This is useful to keep a single-item cache around.

Closes: #1073
Approved by: alexlarsson
2017-10-04 10:27:14 +00:00
Alexander Larsson
73f44dd656 Add extensions to /.flatpak-info
This fixes https://github.com/flatpak/flatpak/issues/502

Closes: #1069
Approved by: alexlarsson
2017-10-03 08:01:46 +00:00
Alexander Larsson
acdf869693 common: Add commit id to FlatpakExtension
Closes: #1069
Approved by: alexlarsson
2017-10-03 08:01:46 +00:00
Alexander Larsson
f04bc43eef Add commit ids for app and runtime to /.flatpak-info
Closes: #1069
Approved by: alexlarsson
2017-10-03 08:01:46 +00:00
Alexander Larsson
0ab0e94647 Add flatpak_deploy_get_deploy_data helpers
Closes: #1069
Approved by: alexlarsson
2017-10-03 08:01:46 +00:00
Alexander Larsson
1fbdda5d0e run: Add some helpers to add fds to the argv array
This cleans up a bunch of repeated code.
2017-10-02 14:53:04 +02:00
Alexander Larsson
160f4e6224 Don't fail update if we can't update remote metadata
This blocks the entire update just for one remote failing.
2017-10-02 10:10:07 +02:00
Alexander Larsson
bbdf2d11c8 build: Export FLATPAK_ID and FLATPAK_ARCH
These are useful to have when building things.

Closes: #1052
Approved by: alexlarsson
2017-09-29 09:35:26 +00:00
AsciiWolf
bc2d72adeb Update Czech translation
Closes: #1050
Approved by: alexlarsson
2017-09-28 17:17:44 +00:00
Sam Spilsbury
88be75cbb3 lib: Add flatpak_installation_prune_local_repo
This is a method to explicitly prune the local repo, which
users might want to use if they had explicitly removed refs from
the underlying flatpak repo and want to ensure that the objects
referred to by those refs are cleared to save on disk space.

Closes: #1034
Approved by: alexlarsson
2017-09-28 15:39:05 +00:00
Sam Spilsbury
d0af046a2f system-helper: Add PruneLocalRepo method
We might want to prune the repo from within the library or
the command line and may not be in a privileged context, so
we'll need to jump through the system helper to prune the refs.

Closes: #1034
Approved by: alexlarsson
2017-09-28 15:39:05 +00:00