From af494aac5f759b599316ec46567408b3c15bf13a Mon Sep 17 00:00:00 2001
From: Ludovico de Nittis <ludovico.denittis@collabora.com>
Date: Tue, 6 Oct 2020 14:29:16 +0200
Subject: [PATCH] wrap: Do not lock LD_PRELOAD

For LD_PRELOAD we want to use the value `-launcher` might be receiving
from `-launch`, so we don't want to lock it's value in `wrap`.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
---
 pressure-vessel/wrap.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pressure-vessel/wrap.c b/pressure-vessel/wrap.c
index c78e454b2..c107efb3c 100644
--- a/pressure-vessel/wrap.c
+++ b/pressure-vessel/wrap.c
@@ -1868,8 +1868,6 @@ main (int argc,
 
   if (adjusted_ld_preload->len != 0)
     flatpak_bwrap_set_env (bwrap, "LD_PRELOAD", adjusted_ld_preload->str, TRUE);
-  else
-    g_hash_table_add (extra_locked_vars_to_unset, g_strdup ("LD_PRELOAD"));
 
   g_debug ("Making Steam environment variables available if required...");
   for (i = 0; i < G_N_ELEMENTS (known_required_env); i++)
@@ -1995,6 +1993,11 @@ main (int argc,
 
       g_assert (equals != NULL);
 
+      /* Never lock LD_PRELOAD, otherwise, for example, we might miss the
+       * overlay renderer library that the Steam client adds to LD_PRELOAD */
+      if (g_str_has_prefix (bwrap->envp[i], "LD_PRELOAD="))
+        continue;
+
       *equals = '\0';
 
       g_string_append (lock_env, bwrap->envp[i]);
-- 
GitLab