Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FOD hash-mismatch errors to the build log #8173

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thufschmitt
Copy link
Member

Fixes #8166.

The implementation in local-derivation-goal.cc is a bit too convoluted for my taste, but I don't know whether there'a an easier way for dumping an error to a Sink, so 馃し

Checklist for maintainers

Maintainers: tick if completed or explain if not relevant

  • agreed on idea
  • agreed on implementation strategy
  • tests, as appropriate
    • functional tests - tests/**.sh
    • unit tests - src/*/tests
    • integration tests - tests/nixos/*
  • documentation in the manual
  • documentation in the internal API docs
  • code and comments are self-explanatory
  • commit message explains why the change was made
  • new feature or incompatible change: updated release notes

Priorities

Add 馃憤 to pull requests you find important.

@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Apr 6, 2023
@picnoir
Copy link
Member

picnoir commented Apr 7, 2023

Thanks a lot for tackling this <3

The hash mismatch message does appear in nix log with this PR, however, it does at the very top of the log:

/tmp/tmp.KRKQZ67Z6f 禄 nix log /nix/store/hxj5rv8170q15j36xz4x0sj9jllvpagg-repro-0.0.drv > test                                                                                                          ninjatrappeur@framework

/tmp/tmp.KRKQZ67Z6f 禄 cat test                                                                                                                                                                          ninjatrappeur@framework
error: hash mismatch in fixed-output derivation '/nix/store/hxj5rv8170q15j36xz4x0sj9jllvpagg-repro-0.0.drv':
         specified: sha256-0000000000000000000000000000000000000000000=
            got:    sha256-WJG1tSLV3whtD/CxEPvZ0hu0/HFjrzTQgoai6Eb2vgM=@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/qcjc1p279ric98fs6vqnyd76yd8vjk6p-tmp.KRKQZ67Z6f
source root is tmp.KRKQZ67Z6f
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
@nix { "action": "setPhase", "phase": "installPhase" }
installing
no Makefile or custom installPhase, doing nothing
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0
checking for references to /build/ in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0...
patching script interpreter paths in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0

I guess the logsink is populated down the road in derivation-goal.cc (this part is quite dense and hard to dive in!)

@thufschmitt
Copy link
Member Author

however, it does at the very top of the log:

Uh my bad, I've used the wrong method for writing the log. The writing is buffered, but the method I've used (.write()) bypasses that buffer. This means that the hash-mismatch exception is interleaved in the middle of the log. If you try with a log big-enough to not fit in the buffer you'll see that it falls somewhere in the middle. I've just fixed that, it should be properly at the end now

thufschmitt added a commit to tweag/nix that referenced this pull request Apr 7, 2023
The `write` name is ambiguous and could lead to some funny bugs like
NixOS#8173 (comment). So
rename it to the more explicit `writeUnbuffered`.
Besides, this method shouldn't be (and isn't) used outside of the class
implementation, so mark it `protected`.

This makes it more symetrical to `BufferedSource` which uses a
`protected readUnbuffered` method.
@picnoir
Copy link
Member

picnoir commented Apr 7, 2023

Ooof, I was looking in the wrong direction 馃槄 Thanks for the explanation.


Much better, works as expected now!

/tmp/tmp.sveykX6nvu 禄 ~/code-root/github.com/NixOS/nix/outputs/out/bin/nix-build test.nix                             ninjatrappeur@trantor
this derivation will be built:
  /nix/store/4537qi5m02dysfpz9yinw13cspjzzqn1-repro-0.0.drv
building '/nix/store/4537qi5m02dysfpz9yinw13cspjzzqn1-repro-0.0.drv'...
unpacking sources
unpacking source archive /nix/store/x78f23szjgnpp40xzjvqfb5zxjryayjh-tmp.sveykX6nvu
source root is tmp.sveykX6nvu
patching sources
configuring
no configure script, doing nothing
building
installing
no Makefile or custom installPhase, doing nothing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0
checking for references to /build/ in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0...
patching script interpreter paths in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0
error: hash mismatch in fixed-output derivation '/nix/store/4537qi5m02dysfpz9yinw13cspjzzqn1-repro-0.0.drv':
         specified: sha256-0000000000000000000000000000000000000000000=
            got:    sha256-WJG1tSLV3whtD/CxEPvZ0hu0/HFjrzTQgoai6Eb2vgM=

/tmp/tmp.sveykX6nvu 禄 nix log /nix/store/4537qi5m02dysfpz9yinw13cspjzzqn1-repro-0.0.drv > out                         ninjatrappeur@trantor

/tmp/tmp.sveykX6nvu 禄 cat out                                                                                         ninjatrappeur@trantor
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/x78f23szjgnpp40xzjvqfb5zxjryayjh-tmp.sveykX6nvu
source root is tmp.sveykX6nvu
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
no configure script, doing nothing
@nix { "action": "setPhase", "phase": "buildPhase" }
building
@nix { "action": "setPhase", "phase": "installPhase" }
installing
no Makefile or custom installPhase, doing nothing
@nix { "action": "setPhase", "phase": "fixupPhase" }
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0
checking for references to /build/ in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0...
patching script interpreter paths in /nix/store/nkrm4gmd6zaxkly9dhqz4cw7lz0sjwjd-repro-0.0
error: hash mismatch in fixed-output derivation '/nix/store/4537qi5m02dysfpz9yinw13cspjzzqn1-repro-0.0.drv':
         specified: sha256-0000000000000000000000000000000000000000000=
            got:    sha256-WJG1tSLV3whtD/CxEPvZ0hu0/HFjrzTQgoai6Eb2vgM=%                                                                    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The FOD hash mismatch error message is missing from nix logs
2 participants