[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/09: daemon: check: Keep the differing output if -K is given.
From: |
Ludovic Courtès |
Subject: |
07/09: daemon: check: Keep the differing output if -K is given. |
Date: |
Tue, 31 May 2016 12:34:02 +0000 (UTC) |
civodul pushed a commit to branch master
in repository guix.
commit 7f3b2510d6b050b8fb0974fa0cd7a164ac51f6d1
Author: Eelco Dolstra <address@hidden>
Date: Tue Jan 12 16:44:26 2016 +0100
daemon: check: Keep the differing output if -K is given.
This makes it easier to investigate the non-determinism, e.g.
$ nix-build pkgs/stdenv/linux -A stage1.pkgs.zlib --check -K
error: derivation
‘/nix/store/l54i8wlw22656i4pk05c52ngv9rpl39q-zlib-1.2.8.drv’ may not be
deterministic: output ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8’
differs from ‘/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check’
$ diffoscope /nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8
/nix/store/11a27shh6n2ivi4a7s964i65ql80cf27-zlib-1.2.8-check
...
├── lib/libz.a
│ ├── metadata
│ │ @@ -1,15 +1,15 @@
│ │ -rw-r--r-- 30001/30000 3096 Jan 12 15:20 2016 adler32.o
...
│ │ +rw-r--r-- 30001/30000 3096 Jan 12 15:28 2016 adler32.o
...
Co-authored-by: Ludovic Courtès <address@hidden>
---
doc/guix.texi | 4 ++++
nix/libstore/build.cc | 14 ++++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/doc/guix.texi b/doc/guix.texi
index 01363c1..cd4e550 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4332,6 +4332,10 @@ substitutes are genuine (@pxref{Substitutes}), or
whether the build result
of a package is deterministic. @xref{Invoking guix challenge}, for more
background information and tools.
+When used in conjunction with @option{--keep-failed}, the differing
+output is kept in the store, under @file{/gnu/store/@dots{}-check}.
+This makes it easy to look for differences between the two results.
+
@item --derivations
@itemx -d
Return the derivation paths, not the output paths, of the given
diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc
index dd8660d..d51705b 100644
--- a/nix/libstore/build.cc
+++ b/nix/libstore/build.cc
@@ -2431,8 +2431,18 @@ void DerivationGoal::registerOutputs()
if (buildMode == bmCheck) {
if (!store->isValidPath(path)) continue;
ValidPathInfo info = worker.store.queryPathInfo(path);
- if (hash.first != info.hash)
- throw Error(format("derivation `%1%' may not be deterministic:
hash mismatch in output `%2%'") % drvPath % path);
+ if (hash.first != info.hash) {
+ if (settings.keepFailed) {
+ Path dst = path + "-check";
+ if (pathExists(dst)) deletePath(dst);
+ if (rename(actualPath.c_str(), dst.c_str()))
+ throw SysError(format("renaming `%1%' to `%2%'") %
actualPath % dst);
+ throw Error(format("derivation `%1%' may not be
deterministic: output `%2%' differs from ‘%3%’")
+ % drvPath % path % dst);
+ } else
+ throw Error(format("derivation `%1%' may not be
deterministic: output `%2%' differs")
+ % drvPath % path);
+ }
continue;
}
- branch master updated (8fe5d95 -> b452811), Ludovic Courtès, 2016/05/31
- 02/09: daemon: ~PathLocks(): Handle exceptions., Ludovic Courtès, 2016/05/31
- 07/09: daemon: check: Keep the differing output if -K is given.,
Ludovic Courtès <=
- 08/09: daemon: Canonicalize gids to 0., Ludovic Courtès, 2016/05/31
- 09/09: daemon: rounds: Keep the differing output if -K is given., Ludovic Courtès, 2016/05/31
- 05/09: daemon: check: Fix assertion failure when some outputs are missing., Ludovic Courtès, 2016/05/31
- 01/09: daemon: Handle /tmp being a symlink., Ludovic Courtès, 2016/05/31
- 03/09: daemon: Fix --repair failure on multiple-output derivations., Ludovic Courtès, 2016/05/31
- 06/09: daemon: check: Fix "failed to produce output path"., Ludovic Courtès, 2016/05/31
- 04/09: daemon: When repairing, rebuild if there is no substituter., Ludovic Courtès, 2016/05/31