projects/guix·commit 425aa1bf

daemon: Dereference symlinks for /etc/services & co.

425aa1bf · Ludovic Courtès <[email protected]> · 2026-03-25 18:58:12 +01:00

Fixes a regression on Guix System introduced in
c4298638ca27717be4a83cb033dcbfecdea88093 (from guix/guix#4178) where files in
/etc, such as /etc/services, would be symlinks.  Consequently, the chroot of
fixed-output derivations would contain a dangling symlink for /etc/services,
leading to name resolution failures in the chroot.

This also relates to 82f84f5e7fb34cc719ed6ea538a3d1ca7516f23d.

* nix/libstore/build.cc (DerivationGoal::startBuilder): Add call to
‘canonPath’.

Change-Id: If34c8e74447ffc03d9fa81a1ea6bc0aef7c4d0b3
Signed-off-by: Ludovic Courtès <[email protected]>
Commit
425aa1bf7c35839f5e500515ff3b5a861a7533d6
Parents
3b90fc5b

Changes

1 files changed · +4 −1

FileStatusAddDelContent
nix/libstore/build.ccmodified+4−1View file

nix/libstore/build.cc

View file
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index 9bdf0a7..7dd630c 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2805,7 +2805,10 @@ void DerivationGoal::startBuilder()
}
for (auto & file : files) {
if (pathExists(file)) {
- ctx.filesInChroot[file] = file;
+ /* On Guix System, /etc/services is a symlink; likewise,
+ on systemd-based system, /etc/resolv.conf is a symlink.
+ Dereference them. */
+ ctx.filesInChroot[file] = canonPath(file, true);
ctx.readOnlyFilesInChroot.insert(file);
}
}