diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-05-10 16:11:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-10 16:11:38 +0200 |
commit | b68a85df0afd89b40c93a9441c2a29ff6c4ba3d1 (patch) | |
tree | 4be8e834a7256e067f89e5fee5f6d2614eb7abbb | |
parent | 51b2bf150726f8d60b97aba79086654a631620d0 (diff) | |
parent | bf485dcf460cd0df113c33f36c9f1f29d6e3a2d5 (diff) |
Merge pull request #4776 from NixOS/fix-ca-normalization
Properly normalize the content-addressed paths
-rw-r--r-- | src/libstore/build/local-derivation-goal.cc | 8 | ||||
-rw-r--r-- | tests/build.sh | 7 | ||||
-rw-r--r-- | tests/ca/build.sh | 8 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc index 4a67b3f47..9c14c06b4 100644 --- a/src/libstore/build/local-derivation-goal.cc +++ b/src/libstore/build/local-derivation-goal.cc @@ -2300,10 +2300,6 @@ void LocalDerivationGoal::registerOutputs() sink.s = make_ref<std::string>(rewriteStrings(*sink.s, outputRewrites)); StringSource source(*sink.s); restorePath(actualPath, source); - - /* FIXME: set proper permissions in restorePath() so - we don't have to do another traversal. */ - canonicalisePathMetaData(actualPath, -1, inodesSeen); } }; @@ -2452,6 +2448,10 @@ void LocalDerivationGoal::registerOutputs() }, }, output.output); + /* FIXME: set proper permissions in restorePath() so + we don't have to do another traversal. */ + canonicalisePathMetaData(actualPath, -1, inodesSeen); + /* Calculate where we'll move the output files. In the checking case we will leave leave them where they are, for now, rather than move to their usual "final destination" */ diff --git a/tests/build.sh b/tests/build.sh index aa54b88eb..ce9d6602c 100644 --- a/tests/build.sh +++ b/tests/build.sh @@ -10,3 +10,10 @@ nix build -f multiple-outputs.nix --json a.all b.all | jq --exit-status ' (.drvPath | match(".*multiple-outputs-b.drv")) and (.outputs.out | match(".*multiple-outputs-b"))) ' + +testNormalization () { + clearStore + outPath=$(nix-build ./simple.nix) + test "$(stat -c %Y $outPath)" -eq 1 +} +testNormalization diff --git a/tests/ca/build.sh b/tests/ca/build.sh index 35bf1dcf7..c8877f87f 100644 --- a/tests/ca/build.sh +++ b/tests/ca/build.sh @@ -59,9 +59,17 @@ testNixCommand () { nix build --experimental-features 'nix-command ca-derivations' --file ./content-addressed.nix --no-link } +# Regression test for https://github.com/NixOS/nix/issues/4775 +testNormalization () { + clearStore + outPath=$(buildAttr rootCA 1) + test "$(stat -c %Y $outPath)" -eq 1 +} + # Disabled until we have it properly working # testRemoteCache clearStore +testNormalization testDeterministicCA clearStore testCutoff |