From 0f6f6844c0a02f487b74ea1d0daa422ed4b6b334 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 17 Mar 2021 16:51:41 +0000
Subject: [PATCH] pv-wrap: Automatically copy runtime when running under
 Flatpak, again

This regressed in steamrt/steamlinuxruntime!32 when we stopped
setting the deprecated PRESSURE_VESSEL_COPY_RUNTIME_INTO environment
variable. If getenv() returns NULL, we need to keep the previous
setting - TRUE in a Flatpak app or FALSE otherwise - instead of
overriding it to FALSE.

Fixes: steamrt/steamlinuxruntime!32
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/wrap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index 78c48d398..65f4bb90b 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -782,7 +782,7 @@ opt_copy_runtime_into_cb (const gchar *option_name,
 {
   if (value == NULL)
     {
-      opt_copy_runtime = FALSE;
+      /* Do nothing, keep previous setting */
     }
   else if (value[0] == '\0')
     {
@@ -1349,13 +1349,11 @@ main (int argc,
 
   original_environ = g_get_environ ();
 
-  if (is_flatpak_env)
-    opt_copy_runtime = TRUE;
-
   is_main_program = check_main_program (argc, argv);
 
   /* Set defaults */
   opt_batch = pv_boolean_environment ("PRESSURE_VESSEL_BATCH", FALSE);
+  opt_copy_runtime = is_flatpak_env;
   /* Process COPY_RUNTIME_INFO first so that COPY_RUNTIME and VARIABLE_DIR
    * can override it */
   opt_copy_runtime_into_cb ("$PRESSURE_VESSEL_COPY_RUNTIME_INTO",
-- 
GitLab