From 59a02c5bbba15b1bdae40bcfc72fe49ca18aaa03 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 6 Aug 2021 15:25:25 +0100
Subject: [PATCH] pv-runtime: Never bind-mount /etc/ld.so.cache,
 /etc/ld.so.conf

bind_runtime_ld_so() is called whenever bwrap != NULL, and it makes
/etc/ld.so.cache, /etc/ld.so.conf into symlinks to
/run/pressure-vessel/ldso/ so that we can regenerate ld.so.cache
in the adverb. This is done whether we have a mutable sysroot or not.

This resolves an automated test failure when running with
--no-copy-runtime.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 pressure-vessel/runtime.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/pressure-vessel/runtime.c b/pressure-vessel/runtime.c
index 59910dfa9..78f9e2f98 100644
--- a/pressure-vessel/runtime.c
+++ b/pressure-vessel/runtime.c
@@ -2466,6 +2466,8 @@ bind_runtime_base (PvRuntime *self,
   static const char * const dont_bind[] =
   {
     "/etc/asound.conf",
+    "/etc/ld.so.cache",
+    "/etc/ld.so.conf",
     "/etc/localtime",
     "/etc/machine-id",
     "/var/cache/ldconfig",
@@ -2602,16 +2604,6 @@ bind_runtime_base (PvRuntime *self,
           if (self->provider != NULL && g_strv_contains (from_provider, dest))
             continue;
 
-          if (self->mutable_sysroot != NULL)
-            {
-              /* If we have a mutable sysroot, we handle ld.so.cache
-               * separately later, because we want to set it up to be
-               * possible for the -adverb to overwrite it. */
-              if (strcmp (dest, "/etc/ld.so.cache") == 0
-                  || strcmp (dest, "/etc/ld.so.conf") == 0)
-                continue;
-            }
-
           full = g_build_filename (self->runtime_files,
                                    bind_mutable[i],
                                    member,
-- 
GitLab