From 5b6ddff455228e30613dd1215fe8755c94902d4e Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 2 Sep 2020 18:06:11 +0100
Subject: [PATCH] wrap: Only rewrite environment variables if they really
 changed

A reasonably common case is that the value on the host and in the
container will be the same.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 src/wrap.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/wrap.c b/src/wrap.c
index b4733ff27..18dfa71b1 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -258,8 +258,12 @@ bind_and_propagate_from_environ (const char *variable,
    * instead, and then create the same symlink in the container. */
   flatpak_bwrap_add_args (bwrap,
                           "--bind", value_host, value_host,
-                          "--setenv", variable, value_host,
                           NULL);
+
+  if (strcmp (value, value_host) != 0)
+    flatpak_bwrap_add_args (bwrap,
+                            "--setenv", variable, value_host,
+                            NULL);
 }
 
 /* Order matters here: root, steam and steambeta are or might be symlinks
-- 
GitLab