daemon: Fix compilation error while using Zig (LLVM)

* nix/libstore/build.cc (guestUID, guestGID): Rename to 'defaultGuestUID' and
'defaultGuestGID' respectively.
(initializeUserNamespace, DerivationGoal::startBuilder): Rename references to
variables accordingly.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Congcong Kuo 2025-10-28 01:00:58 +08:00 committed by Ludovic Courtès
parent 9d5f3c6b3a
commit 0ef4d33da9
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -1638,15 +1638,15 @@ void chmod_(const Path & path, mode_t mode)
/* UID and GID of the build user inside its own user namespace. */
static const uid_t guestUID = 30001;
static const gid_t guestGID = 30000;
static const uid_t defaultGuestUID = 30001;
static const gid_t defaultGuestGID = 30000;
/* Initialize the user namespace of CHILD. */
static void initializeUserNamespace(pid_t child,
uid_t hostUID = getuid(),
gid_t hostGID = getgid(),
uid_t guestUID = guestUID,
gid_t guestGID = guestGID,
uid_t guestUID = defaultGuestUID,
gid_t guestGID = defaultGuestGID,
const std::vector<std::pair<gid_t, gid_t>> extraGIDs = {},
bool haveCapSetGID = false)
{
@ -2763,14 +2763,14 @@ void DerivationGoal::startBuilder()
std::format(
"nixbld:x:{}:{}:Nix build user:/:/noshell\n"
"nobody:x:65534:65534:Nobody:/:/noshell\n",
buildUser.enabled() ? buildUser.getUID() : guestUID,
buildUser.enabled() ? buildUser.getGID() : guestGID));
buildUser.enabled() ? buildUser.getUID() : defaultGuestUID,
buildUser.enabled() ? buildUser.getGID() : defaultGuestGID));
/* Declare the build user's group so that programs get a consistent
view of the system (e.g., "id -gn"). */
writeFile(chrootRootDir + "/etc/group",
std::format("nixbld:!:{}:\n",
buildUser.enabled() ? buildUser.getGID() : guestGID));
buildUser.enabled() ? buildUser.getGID() : defaultGuestGID));
if (fixedOutput) {
/* Fixed-output derivations typically need to access the network,
@ -3020,7 +3020,7 @@ void DerivationGoal::startBuilder()
auto extraGIDs = kvmGIDMapping();
initializeUserNamespace(pid,
getuid(), getgid(),
guestUID, guestGID, extraGIDs);
defaultGuestUID, defaultGuestGID, extraGIDs);
writeFull(parentSetupSocket, (unsigned char*)"go\n", 3);
}