From 42e42ddc86c96579b32c0f30a29fd8fccf0612d5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Wed, 3 Apr 2019 18:04:38 +0200 Subject: [PATCH] Pick up the right revokefs-fuse binary In the normal case, pass the full LIBEXEC path, and in the tests, pass the path via the env var FLATPAK_REVOKEFS_FUSE. Closes: #2657 Approved by: alexlarsson --- common/Makefile.am.inc | 1 + common/flatpak-dir.c | 6 +++++- system-helper/Makefile.am.inc | 2 +- system-helper/flatpak-system-helper.c | 6 +++++- tests/Makefile.am.inc | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/common/Makefile.am.inc b/common/Makefile.am.inc index 98d51b51..5483ac4e 100644 --- a/common/Makefile.am.inc +++ b/common/Makefile.am.inc @@ -141,6 +141,7 @@ libflatpak_common_la_CFLAGS = \ $(INTERNAL_GPGME_CFLAGS) \ $(SYSTEMD_CFLAGS) \ $(DCONF_CFLAGS) \ + -DLIBEXECDIR=\"$(libexecdir)\" \ -I$(srcdir)/dbus-proxy \ $(NULL) libflatpak_common_la_LIBADD = $(AM_LIBADD) libglnx.la $(BASE_LIBS) $(OSTREE_LIBS) $(SOUP_LIBS) $(JSON_LIBS) $(XAUTH_LIBS) $(LIBSECCOMP_LIBS) $(INTERNAL_GPGME_LIBS) $(SYSTEMD_LIBS) $(DCONF_LIBS) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index c543c5c6..5a5f4342 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -7842,6 +7842,10 @@ flatpak_dir_setup_revokefs_fuse_mount (FlatpakDir *self, g_autofree gchar *mnt_dir_tmp = NULL; gint socket = -1; gboolean res = FALSE; + const char *revokefs_fuse_bin = LIBEXECDIR "/revokefs-fuse"; + + if (g_getenv ("FLATPAK_REVOKEFS_FUSE")) + revokefs_fuse_bin = g_getenv ("FLATPAK_REVOKEFS_FUSE"); if (!flatpak_dir_system_helper_call_get_revokefs_fd (self, FLATPAK_HELPER_GET_REVOKEFS_FD_FLAGS_NONE, @@ -7877,7 +7881,7 @@ flatpak_dir_setup_revokefs_fuse_mount (FlatpakDir *self, g_subprocess_launcher_take_fd (launcher, socket, 3); revokefs_fuse = g_subprocess_launcher_spawn (launcher, &local_error, - "revokefs-fuse", "-o", client_uid, "--socket=3", + revokefs_fuse_bin, "-o", client_uid, "--socket=3", src_dir_tmp, mnt_dir_tmp, NULL); if (revokefs_fuse == NULL || !g_subprocess_wait_check (revokefs_fuse, NULL, &local_error)) diff --git a/system-helper/Makefile.am.inc b/system-helper/Makefile.am.inc index 6fbde3b9..cce749ce 100644 --- a/system-helper/Makefile.am.inc +++ b/system-helper/Makefile.am.inc @@ -19,7 +19,7 @@ flatpak_system_helper_SOURCES = \ $(NULL) flatpak_system_helper_LDADD = $(BASE_LIBS) $(OSTREE_LIBS) $(JSON_LIBS) $(POLKIT_LIBS) libflatpak-common.la -flatpak_system_helper_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(APPSTREAM_GLIB_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(POLKIT_CFLAGS) -DFLATPAK_COMPILATION +flatpak_system_helper_CFLAGS = $(BASE_CFLAGS) $(OSTREE_CFLAGS) $(APPSTREAM_GLIB_CFLAGS) $(SOUP_CFLAGS) $(JSON_CFLAGS) $(POLKIT_CFLAGS) -DFLATPAK_COMPILATION -DLIBEXECDIR=\"$(libexecdir)\" system-helper/org.freedesktop.Flatpak.rules: system-helper/org.freedesktop.Flatpak.rules.in $(AM_V_GEN) $(SED) -e "s|\@privileged_group\@|$(PRIVILEGED_GROUP)|" $< > $@ diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c index f7a81e28..d56c94ea 100644 --- a/system-helper/flatpak-system-helper.c +++ b/system-helper/flatpak-system-helper.c @@ -1501,6 +1501,7 @@ ongoing_pull_new (FlatpakSystemHelper *object, g_autoptr(OngoingPull) pull = NULL; g_autoptr(GSubprocessLauncher) launcher = NULL; int sockets[2], exit_sockets[2]; + const char *revokefs_fuse_bin = LIBEXECDIR "/revokefs-fuse"; pull = g_slice_new0 (OngoingPull); pull->object = object; @@ -1541,9 +1542,12 @@ ongoing_pull_new (FlatpakSystemHelper *object, g_subprocess_launcher_take_fd (launcher, exit_sockets[0], 4); pull->backend_exit_socket = exit_sockets[1]; + if (g_getenv ("FLATPAK_REVOKEFS_FUSE")) + revokefs_fuse_bin = g_getenv ("FLATPAK_REVOKEFS_FUSE"); + pull->revokefs_backend = g_subprocess_launcher_spawn (launcher, error, - "revokefs-fuse", + revokefs_fuse_bin, "--backend", "--socket=3", "--exit-with-fd=4", diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc index 1dd7c979..2da05366 100644 --- a/tests/Makefile.am.inc +++ b/tests/Makefile.am.inc @@ -2,6 +2,7 @@ AM_TESTS_ENVIRONMENT = FLATPAK_TESTS_DEBUG=1 \ FLATPAK_CONFIG_DIR=/dev/null \ FLATPAK_TRIGGERSDIR=$$(cd $(top_srcdir) && pwd)/triggers \ FLATPAK_VALIDATE_ICON=$$(cd $(top_builddir) && pwd)/flatpak-validate-icon \ + FLATPAK_REVOKEFS_FUSE=$$(cd $(top_builddir) && pwd)/revokefs-fuse \ FLATPAK_DBUSPROXY=$$(cd $(top_builddir) && pwd)/flatpak-dbus-proxy \ GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH} \ LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd)$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH} \