Skip to content

Commit

Permalink
Merge branch 'AGL' into 'AGL'
Browse files Browse the repository at this point in the history
Update Flatpak to handle /var/tmp being a symlink

See merge request CodethinkLabs/agl/meta-flatpak!6
  • Loading branch information
jjardon committed Oct 5, 2021
2 parents 5a5a4cf + 2c03589 commit cd6d141
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 5 deletions.
50 changes: 50 additions & 0 deletions recipes-flatpak/flatpak/files/vartmp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/common/flatpak-exports.c b/common/flatpak-exports.c
index 7e26d034..904198b0 100644
--- a/common/flatpak-exports.c
+++ b/common/flatpak-exports.c
@@ -657,10 +657,10 @@ flatpak_exports_path_is_visible (FlatpakExports *exports,
static gboolean
never_export_as_symlink (const char *path)
{
- /* Don't export /tmp as a symlink even if it is on the host, because
- that will fail with the pre-existing directory we created for /tmp,
+ /* Don't export {/var,}/tmp as a symlink even if it is on the host, because
+ that will fail with the pre-existing directory we created for it,
and anyway, it being a symlink is not useful in the sandbox */
- if (strcmp (path, "/tmp") == 0)
+ if (strcmp (path, "/tmp") == 0 || strcmp (path, "/var/tmp") == 0)
return TRUE;

return FALSE;
diff --git a/tests/test-exports.c b/tests/test-exports.c
index b39fd477..c0af5689 100644
--- a/tests/test-exports.c
+++ b/tests/test-exports.c
@@ -1305,6 +1305,8 @@ test_exports_unusual (void)
{ "usr/lib", FAKE_DIR },
{ "usr/share", FAKE_DIR },
{ "var/home/me", FAKE_DIR },
+ { "var/volatile/tmp", FAKE_DIR },
+ { "var/tmp", FAKE_SYMLINK, "volatile/tmp" },
{ NULL }
};
g_autoptr(FlatpakBwrap) bwrap = flatpak_bwrap_new (NULL);
@@ -1333,6 +1335,9 @@ test_exports_unusual (void)
flatpak_exports_add_path_expose (exports,
FLATPAK_FILESYSTEM_MODE_READ_ONLY,
"/tmp");
+ flatpak_exports_add_path_expose (exports,
+ FLATPAK_FILESYSTEM_MODE_READ_WRITE,
+ "/var/tmp");
flatpak_exports_add_path_expose (exports,
FLATPAK_FILESYSTEM_MODE_READ_ONLY,
"not-absolute");
@@ -1346,6 +1351,8 @@ test_exports_unusual (void)
i = assert_next_is_bind (bwrap, i, "--ro-bind", "/tmp", "/tmp");
i = assert_next_is_bind (bwrap, i, "--ro-bind", "/var/home/me",
"/var/home/me");
+ i = assert_next_is_bind (bwrap, i, "--bind", "/var/tmp",
+ "/var/tmp");
i = assert_next_is_bind (bwrap, i, "--ro-bind", "/usr", "/run/host/usr");
i = assert_next_is_symlink (bwrap, i, "usr/bin", "/run/host/bin");
i = assert_next_is_symlink (bwrap, i, "usr/lib", "/run/host/lib");
11 changes: 6 additions & 5 deletions recipes-flatpak/flatpak/flatpak_git.bb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c"

SRC_URI = " \
gitsm://[email protected]/flatpak/flatpak;protocol=https;branch=flatpak-1.10.x \
gitsm://[email protected]/flatpak/flatpak;protocol=https;branch=master \
"
SRC_URI += " file://vartmp.patch "

SRCREV = "c614eb400ed9f9ec516d74a43e7d63783e3fe1fb"
SRCREV = "dd6b99d0d30129c1beab8fe61ba4f1beb15930c5"

PV = "1.10.2+git${SRCPV}"
PV = "1.11.3+git${SRCPV}"
S = "${WORKDIR}/git"

inherit autotools pkgconfig gettext systemd gobject-introspection gtk-doc manpages
Expand Down Expand Up @@ -95,8 +96,8 @@ do_configure[vardeps] += "SYSROOT_DIR"
do_configure_prepend() {
# this reflects what autogen.sh does, but the OE wrappers for autoreconf
# allow it to work without the other gyrations which exist there
sed -e 's,$(libglnx_srcpath),libglnx,g' < ${S}/libglnx/Makefile-libglnx.am >${S}/libglnx/Makefile-libglnx.am.inc
sed -e 's,$(bwrap_srcpath),bubblewrap,g' < ${S}/bubblewrap/Makefile-bwrap.am >${S}/bubblewrap/Makefile-bwrap.am.inc
sed -e 's,$(libglnx_srcpath),subprojects/libglnx,g' < ${S}/subprojects/libglnx/Makefile-libglnx.am >${S}/subprojects/libglnx/Makefile-libglnx.am.inc
sed -e 's,$(bwrap_srcpath),subprojects/bubblewrap,g' < ${S}/subprojects/bubblewrap/Makefile-bwrap.am >${S}/subprojects/bubblewrap/Makefile-bwrap.am.inc
}

BBCLASSEXTEND = "native"

0 comments on commit cd6d141

Please sign in to comment.