Skip to content

Commit

Permalink
Assign the build directory to the effective user, if present
Browse files Browse the repository at this point in the history
  • Loading branch information
balsoft committed Feb 7, 2024
1 parent 5ef3f14 commit 7a49064
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/libstore/build/local-derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,17 @@ void LocalDerivationGoal::deleteTmpDir(bool force)
might have privileged stuff (like a copy of netrc). */
if (settings.keepFailed && !force && !drv->isBuiltin()) {
printError("note: keeping build directory '%s'", tmpDir);
chmod(tmpDir.c_str(), 0755);
bool chowned = false;
struct stat info;
stat(tmpDir.c_str(), &info);
if (experimentalFeatureSettings.isEnabled(Xp::ACLs))
if (auto store = dynamic_cast<LocalGranularAccessStore*>(&worker.store))
if (store->effectiveUser) {
chown(tmpDir.c_str(), store->effectiveUser->uid, info.st_gid);
chowned = true;
}
if (!chowned)
chmod(tmpDir.c_str(), 0755);
}
else
deletePath(tmpDir);
Expand Down

0 comments on commit 7a49064

Please sign in to comment.