nix build --keep-going should display all FOD hash mismatches just as nix-build does it. #302

Closed
opened 2024-05-11 14:02:50 +00:00 by ma27 · 3 comments
Member

Given an expression like

with import <nixpkgs> {};
{
  src1 = fetchurl {
    url = "https://example.com";
    hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  };
  src2 = fetchurl {
    url = "https://example.org";
    hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  };
  src3 = fetchurl {
    url = "https://www.example.com/";
    hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
  };
}

nix build -L -f test.nix --keep-going outputs:

`nix build` output
www.example.com> trying https://www.example.com/
www.example.com>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
www.example.com>                                  Dload  Upload   Total   Spent    Left  Speed
example.com> trying https://example.com
example.com>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
example.com>                                  Dload  Upload   Total   Spent    Left  Speed
example.org> trying https://example.org
example.org>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
example.org>                                  Dload  Upload   Total   Spent    Left  Speed
www.example.com> 100  1256  100  1256    0     0   2949      0 --:--:-- --:--:-- --:--:--  2955
example.com> 100  1256  100  1256    0     0   3006      0 --:--:-- --:--:-- --:--:--  3011
example.org> 100  1256  100  1256    0     0   2960      0 --:--:-- --:--:-- --:--:--  2962
error: hash mismatch in fixed-output derivation '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk=

whereas nix-build test.nix --keep-going displays all mismatches:

`nix-build` output
these 3 derivations will be built:
  /nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv
  /nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv
  /nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv
building '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv'...
building '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv'...
building '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv'...

trying https://example.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

trying https://example.org
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

trying https://www.example.com/
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1256  100  1256    0     0   3000      0 --:--:-- --:--:-- --:--:--  2997
100  1256  100  1256    0     0   2970      0 --:--:-- --:--:-- --:--:--  2969
100  1256  100  1256    0     0   3018      0 --:--:-- --:--:-- --:--:--  3011
error: hash mismatch in fixed-output derivation '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk=
error: hash mismatch in fixed-output derivation '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk=
error: hash mismatch in fixed-output derivation '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv':
         specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
            got:    sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk=
error: build of '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv', '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv', '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv' failed

I think the behavior of nix-build is very useful and I'd like to have it with nix build as well.

Behavior observed with nix (Lix, like Nix) 2.90.0pre20240510_f6dc40c.

Given an expression like ```nix with import <nixpkgs> {}; { src1 = fetchurl { url = "https://example.com"; hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }; src2 = fetchurl { url = "https://example.org"; hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }; src3 = fetchurl { url = "https://www.example.com/"; hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; }; } ``` `nix build -L -f test.nix --keep-going` outputs: <details><summary>`nix build` output</summary> ``` www.example.com> trying https://www.example.com/ www.example.com> % Total % Received % Xferd Average Speed Time Time Time Current www.example.com> Dload Upload Total Spent Left Speed example.com> trying https://example.com example.com> % Total % Received % Xferd Average Speed Time Time Time Current example.com> Dload Upload Total Spent Left Speed example.org> trying https://example.org example.org> % Total % Received % Xferd Average Speed Time Time Time Current example.org> Dload Upload Total Spent Left Speed www.example.com> 100 1256 100 1256 0 0 2949 0 --:--:-- --:--:-- --:--:-- 2955 example.com> 100 1256 100 1256 0 0 3006 0 --:--:-- --:--:-- --:--:-- 3011 example.org> 100 1256 100 1256 0 0 2960 0 --:--:-- --:--:-- --:--:-- 2962 error: hash mismatch in fixed-output derivation '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv': specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= got: sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk= ``` </details> whereas `nix-build test.nix --keep-going` displays all mismatches: <details><summary>`nix-build` output</summary> ``` these 3 derivations will be built: /nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv /nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv /nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv building '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv'... building '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv'... building '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv'... trying https://example.com % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed trying https://example.org % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed trying https://www.example.com/ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1256 100 1256 0 0 3000 0 --:--:-- --:--:-- --:--:-- 2997 100 1256 100 1256 0 0 2970 0 --:--:-- --:--:-- --:--:-- 2969 100 1256 100 1256 0 0 3018 0 --:--:-- --:--:-- --:--:-- 3011 error: hash mismatch in fixed-output derivation '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv': specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= got: sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk= error: hash mismatch in fixed-output derivation '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv': specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= got: sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk= error: hash mismatch in fixed-output derivation '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv': specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= got: sha256-6o+sfGX7WJsNU1YPUlH3T56bJDR43Laz6nm142RJyNk= error: build of '/nix/store/6v1f3xjl2aabqsppxbafbjg601sxnjcx-example.com.drv', '/nix/store/rfam3yc6mcgnwanh3rbwl5pd454w6mib-example.org.drv', '/nix/store/v62mxccqxf98zld687mhmxxxsc82p2nx-www.example.com.drv' failed ``` </details> I think the behavior of `nix-build` is very useful and I'd like to have it with `nix build` as well. Behavior observed with `nix (Lix, like Nix) 2.90.0pre20240510_f6dc40c`.
ma27 added the
bug
label 2024-05-11 14:02:50 +00:00
Owner

this should definitely be fixed wtf. why are these even different between nix3 and nix-build…

this should definitely be fixed wtf. why are these even different between nix3 and nix-build…
qyriad added the
E/easy
label 2024-05-11 17:19:19 +00:00
Author
Member

Have a patch locally, just didn't get to writing a test yet :)

Have a patch locally, just didn't get to writing a test yet :)
ma27 self-assigned this 2024-05-12 14:53:33 +00:00
Author
Member
Proposed a fix in https://gerrit.lix.systems/c/lix/+/1108
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#302
No description provided.