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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download: make hash mismatch error consistent with fetchurl #2099

Merged
merged 1 commit into from Apr 23, 2018

Conversation

LnL7
Copy link
Member

@LnL7 LnL7 commented Apr 20, 2018

Currently the hash mismatch from nix shows the expected/actual hashes in a different order than eg. fetchurl from nixpkgs.


error: hash mismatch in file downloaded from 'http://ftpmirror.gnu.org/hello/hello-2.10.tar.gz': expected hash 'sha256:0000000000000000000000000000000000000000000000000000', got 'sha256:0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i'

vs

fixed-output derivation produced path '/nix/store/3x7dwzq014bblazs7kq20p9hyzz0qh8g-hello-2.10.tar.gz' with sha256 hash '0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i' instead of the expected hash '0000000000000000000000000000000000000000000000000000'

@dtzWill
Copy link
Member

dtzWill commented Apr 20, 2018

So this is a bit more complicated--and the ordering is intentional . That said I also have found it confusing since I'm used to the other order as well, and ended up copying wrong hash from it... haha. So I am in favor of improving things :).

Turns out there are a number of places Nix reports wrong hash--and many (all) of them use the order "expected hash X, got Y"--so I wrote it this way to "fit in".

It seems strange to be inconsistent within a single codebase about the ordering.

Perhaps it would make sense to replace all instances of this message?

@LnL7
Copy link
Member Author

LnL7 commented Apr 20, 2018

We could also change nixpkgs. I only realised this because of the recent change, if there are other cases where the order is different it probably explains why I always feel confused about what the correct hash is. 😃

@shlevy
Copy link
Member

shlevy commented Apr 23, 2018

Yeah, I think this ordering is better too.

@shlevy shlevy merged commit 13d4d1c into NixOS:master Apr 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants