Subject: Re: bug#46265: Hash mismatch in the source of package cunit

From: Leo Famulari <[email-masked]>
Date: Tue, 2 Feb 2021 22:25:50 -0500

On Wed, Feb 03, 2021 at 10:23:42AM +0800, Zhu Zihao wrote:
> 
> building /gnu/store/qgri8w2rw585wc9npnbb2nd9qvj6szzs-CUnit-2.1-3.tar.bz2.drv...
> 
> Starting download of /gnu/store/vzq31539zql9s23708sbcrwb51lpwjf7-CUnit-2.1-3.tar.bz2
> From http://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2...
> following redirection to `https://downloads.sourceforge.net/#!/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2'...
> downloading from http://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2 ...
>  CUnit-2.1-3.tar.bz2  746B            2.4MiB/s 00:00 [##################] 100.0%
> sha256 hash mismatch for /gnu/store/vzq31539zql9s23708sbcrwb51lpwjf7-CUnit-2.1-3.tar.bz2:
>   expected hash: 057j82da9vv4li4z5ri3227ybd18nzyq81f6gsvhifs5z0vr3cpm
>   actual hash:   1vc97w0kvchxzlf0v7nn1fzx7pi0ih29cdqd6r7rg1y6parqa6i5

Since it is downloaded over HTTP (unauthenticated), it could be
anything. 746 bytes is really small.

Maybe we can change the Sourceforge URLs used by Guix to avoid
redirecting to an HTTP URL.

From here, it works okay:

------
$ guix download http://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2

Starting download of /tmp/guix-file.29mS0e
From http://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2...
following redirection to `https://managedway.dl.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2'...
 …-3.tar.bz2  502KiB                                                                                                                                  2.4MiB/s 00:00 [##################] 100.0%
/gnu/store/vzq31539zql9s23708sbcrwb51lpwjf7-CUnit-2.1-3.tar.bz2
057j82da9vv4li4z5ri3227ybd18nzyq81f6gsvhifs5z0vr3cpm
------

If you want, you could save the downloaded file for inspection:

$ guix download -o cunit.tar.bz2 http://downloads.sourceforge.net/project/cunit/CUnit/2.1-3/CUnit-2.1-3.tar.bz2