[Nix-dev] Bug(?) in derivation/hashing

Damien Cassou damien at cassou.me
Fri Aug 26 13:18:23 CEST 2016



On August 26, 2016 12:50:48 PM GMT+02:00, Sergey Mironov <grrwlf at gmail.com> wrote:
> I decided to bump a version. Since there is 20160805 version available,
>I wanted to 1) replace "20151220" with "20160805", 2) run `nix-env -i
>urweb` to see a 'Hash mismatch' error, and finaly 3) copy correct hash
>to she sha256 field.
>
>Surprisingly, `nix-env -i urweb` finished without errors. It reported
>that installation of urweb-20160805 was successful, but in fact it was
>old urweb-20151220 with new name. (urweb --version showed it clearly).


This is not a bug but expected behavior. The sha256 field is used to compute the derivation hash. With this hash, Nix checks if there is already something in the store. If yes, this is used as the source without downloading again.

What I do: when I update a derivation, I update the name and I randomly change the sha256. nix-build or nix-env then downloads the new release tarball, compares the sha256s, fails, and tells me the actual sha256. 
-- 
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill


More information about the nix-dev mailing list