1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-27 20:51:00 +01:00

Use std::variant to enforce BuildResult invariants

There is now a clean separation between successful and failing build
results.
This commit is contained in:
John Ericson 2025-09-23 18:09:56 -04:00
parent 43550e8edb
commit e731c43eae
29 changed files with 568 additions and 397 deletions

View file

@ -98,7 +98,7 @@ static void canonicalisePathMetaData_(
(i.e. "touch $out/foo; ln $out/foo $out/bar"). */
if (uidRange && (st.st_uid < uidRange->first || st.st_uid > uidRange->second)) {
if (S_ISDIR(st.st_mode) || !inodesSeen.count(Inode(st.st_dev, st.st_ino)))
throw BuildError(BuildResult::OutputRejected, "invalid ownership on file '%1%'", path);
throw BuildError(BuildResult::Failure::OutputRejected, "invalid ownership on file '%1%'", path);
mode_t mode = st.st_mode & ~S_IFMT;
assert(
S_ISLNK(st.st_mode)