GNU bug report logs - #75810
[PATCH 0/6] Rootless guix-daemon

Previous Next

Package: guix-patches;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Fri, 24 Jan 2025 17:24:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: 75810 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: [bug#75810] [PATCH v7 03/16] daemon: Bind-mount /etc/nsswitch.conf & co. only if it exists.
Date: Thu, 20 Mar 2025 21:54:36 +0100
Those files may be missing in some contexts, for instance within the
build environment.

* nix/libstore/build.cc (DerivationGoal::runChild): Add /etc/resolv.conf
and related files to ‘ss’ only if they exist.

Change-Id: Ie19664a86c8101a1dc82cf39ad4b7abb10f8250a
---
 nix/libstore/build.cc | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index edd01bab34..8ca5e5b732 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2093,10 +2093,11 @@ void DerivationGoal::runChild()
                network, so give them access to /etc/resolv.conf and so
                on. */
             if (fixedOutput) {
-                ss.push_back("/etc/resolv.conf");
-                ss.push_back("/etc/nsswitch.conf");
-                ss.push_back("/etc/services");
-                ss.push_back("/etc/hosts");
+		auto files = { "/etc/resolv.conf", "/etc/nsswitch.conf",
+			       "/etc/services", "/etc/hosts" };
+		for (auto & file: files) {
+		    if (pathExists(file)) ss.push_back(file);
+		}
             }
 
             for (auto & i : ss) dirsInChroot[i] = i;
-- 
2.48.1





This bug report was last modified 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.