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
2021-10-19 10:57:06 -07:00
2019-04-08 12:50:42 +00:00
2021-08-23 12:19:03 +02:00
2021-10-17 13:06:21 +02:00
2021-05-25 11:11:03 +02:00
2021-08-23 08:58:36 +02:00
2021-03-10 10:33:51 +01:00
2018-02-05 15:21:40 +00:00
2021-10-12 10:54:34 +01:00
2015-03-31 15:36:29 +01:00
2016-06-02 18:05:22 -04:00
2021-10-12 10:54:34 +01:00

Flatpak icon

Flatpak is a system for building, distributing, and running sandboxed desktop applications on Linux.

See https://flatpak.org/ for more information.

Community discussion happens in #flatpak:matrix.org, on the mailing list, and on the Flathub Discourse.

Read documentation for Flatpak here.

Contributing

Flatpak welcomes contributions from anyone! Here are some ways you can help:

Hacking

Flatpak uses a traditional autoconf-style build mechanism. To build just do

 ./autogen.sh
 ./configure [args]
 make
 make install

To automatically install dependencies on apt-based distributions you can try running apt build-dep flatpak and on dnf ones try dnf builddep flatpak. Dependencies you will need include: autoconf, automake, libtool, bison, gettext, gtk-doc, gobject-introspection, libcap, libarchive, libxml2, libsoup, gpgme, polkit, libXau, ostree, json-glib, appstream, libseccomp (or their devel packages).

Most configure arguments are documented in ./configure --help. However, there are some options that are a bit more complicated.

Flatpak relies on a project called Bubblewrap for the low-level sandboxing. By default, an in-tree copy of this is built (distributed in the tarball or using git submodules in the git tree). This will build a helper called flatpak-bwrap. If your system has a recent enough version of Bubblewrap already, you can use --with-system-bubblewrap to use that instead.

Bubblewrap can run in two modes, either using unprivileged user namespaces or setuid mode. This requires that the kernel supports this, which some distributions disable. For instance, Debian and Arch (linux kernel v4.14.5 or later), support user namespaces with the kernel.unprivileged_userns_clone sysctl enabled.

If unprivileged user namespaces are not available, then Bubblewrap must be built as setuid root. This is believed to be safe, as it is designed to do this. Any build of Bubblewrap supports both unprivileged and setuid mode, you just need to set the setuid bit for it to change mode.

However, this does complicate the installation a bit. If you pass --with-priv-mode=setuid to configure (of Flatpak or Bubblewrap) then make install will try to set the setuid bit. However that means you have to run make install as root. Alternatively, you can pass --enable-sudo to configure and it will call sudo when setting the setuid bit. Alternatively you can enable setuid completely outside of the installation, which is common for example when packaging Bubblewrap in a .deb or .rpm.

There are some complications when building Flatpak to a different prefix than the system-installed version. First of all, the newly built Flatpak will look for system-installed flatpaks in $PREFIX/var/lib/flatpak, which will not match existing installations. You can use --with-system-install-dir=/var/lib/flatpak to make both installations use the same location.

Secondly, Flatpak ships with a root-privileged PolicyKit helper for system-wide installation, called flatpak-system-helper. It is D-Bus activated (on the system bus) and if you install in a non-standard location it is likely that D-Bus will not find it and PolicyKit integration will not work. However, if the system installation is synchronized, you can often use the system installed helper instead— at least if the two versions are close enough.

This repository

The Flatpak project consists of multiple pieces, and it can be a bit challenging to find your way around at first. Here is a quick intro to each of the important subdirectories:

  • app: the commandline client. Each command has a flatpak-builtins- source file
  • common: contains the library, libflatpak. It also contains various pieces of code that are shared between the library, the client and the services. Non-public code can be recognized by having a -private.h header file.
  • completion: commandline auto completion support
  • data: D-Bus interface definition files and GVariant schemas
  • doc: The sources for the documentation, both man pages and library documentation
  • icon-validator: A small utility that is used to validate icons
  • oci-authenticator: service used for authenticating the user for installing from oci remotes (e.g. for paid apps)
  • po: translations
  • portal: The Flatpak portal service, which lets sandboxed apps request the creation of new sandboxes
  • revokefs: A FUSE filesystem that is used to transfer files downloaded by the user to the system-helper without copying
  • session-helper: The flatpak-session-helper service, which provides various helpers for the sandbox setup at runtime
  • tests: The testsuite
  • subprojects/bubblewrap: Flatpak's unprivileged sandboxing tool which is developed separately and exists here as a submodule
  • subprojects/libglnx: a small utility library for projects that use GLib on Linux, as a submodule
  • subprojects/dbus-proxy: a filtering proxy for D-Bus connections, as a submodule
  • subprojects/variant-schema-compiler: a tool for generating code to efficiently access data encoded using GVariant, as a submodule
  • system-helper: The flatpak-system-helper service, which runs as root on the system bus and allows non-root users to modify system installations

Related Projects

Here are some notable projects in the Flatpak ecosystem:

  • Flatseal: An app for managing permissions of Flatpak apps without using the CLI
  • Souk: A Flatpak-only app store
  • Flat-manager: A tool for managing Flatpak repositories
Description
No description provided
Readme 60 MiB
Languages
C 91.1%
Shell 5.1%
Python 1.8%
Meson 1.1%
Yacc 0.8%