NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.51k stars 13.69k forks source link

R package download succeeding in spite of failing from cran.stat.unipd.it #11584

Closed twhitehead closed 8 years ago

twhitehead commented 8 years ago

I'm getting the following while building the rPackages.maps package

... trying http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 837 100 837 0 0 3772 0 --:--:-- --:--:-- --:--:-- 3839 output path ‘/home/nixbld/store/ghjjncf8rzpynfkgx79y82nkll5r18k1-maps_2.3-11.tar.gz’ should have sha256 hash ‘0752dh646bngw726941p0xd3p9chxlg4mdyns3jc23h68w7da0kc’, instead has ‘102rw6gw1mrbr00s8b1bnz2yh2nqk411qdhs6kncs6scalixjb5p’ cannot build derivation ‘/home/nixbld/store/n9b91lxx8lzf3k5rqjvd965bw581ssy9-r-maps-2.3-11.drv’: 1 dependencies couldn't be built error: build of ‘/home/nixbld/store/n9b91lxx8lzf3k5rqjvd965bw581ssy9-r-maps-2.3-11.drv’ failed

Looking at the mirror in a website reveals that there is no _maps2.3-11.tar.gz under just contrib and manually downloading the path with curl gives you back a basic html page (which I can't seem to include here as a quote as markdown doesn't escape all the html for me).

$ curl http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz ... bunch of html ...

I believe what is suppose to happen is it should realize the download failed and next try the contrib/00Archive/maps directory. I'm guessing something is wrong with this mirror in that it isn't returning an appropriate error?

Thanks! -Tyson

peti commented 8 years ago

What version of Nixpks / channel do you use?

peti commented 8 years ago

For what it's worth, this error does not occur on current master:

$ nix-build ~/.nix-defexpr -A rPackages.maps
/nix/store/78ywbc5blf23sl1i5zyx1hddqarmdsxv-r-maps-3.0.0-2
twhitehead commented 8 years ago

Currently using a slight modified (nothing to do with fetchurl or R though) version of tag 15.09 from September 30th.

twhitehead commented 8 years ago

Maybe it is relevant that I'm running it with the 1.10 release of Nix from September 3rd. I seem to recall there was something about switching some of the fetch stuff to being builtin recently?

twhitehead commented 8 years ago

I see 287f99badae394c38a200170a60189d74d1f52f9 from 15 days ago dropped the cran mirrors and replaced them all with the single mran.revolutionanalytics.com/snapshot/${snapshot} mirror. I guess this would explain why it is working in master but not for me on 15.09.

Out of curiosity what do you get with nix-prefetchurl on the cran.stat.unipd.it mirror

$ nix-prefetch-url http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 837 100 837 0 0 3847 0 --:--:-- --:--:-- --:--:-- 3875 path is ‘/home/nixbld/store/c0jzzh7icc6dl64l1wd72rw15ayb3m6z-maps_2.3-11.tar.gz’ 102rw6gw1mrbr00s8b1bnz2yh2nqk411qdhs6kncs6scalixjb5p

versus the master cran.r-project.org mirror

nix-prefetch-url http://cran.r-project.org/src/contrib/maps_2.3-11.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (22) The requested URL returned error: 404 Not Found /home/nixbld/var/nix/profiles/default/bin/nix-prefetch-url: download of ‘http://cran.r-project.org/src/contrib/maps_2.3-11.tar.gz’ failed

Mathnerd314 commented 8 years ago

This could be fixed in Nixpkgs' fetchurl, by checking the hash before considering the download to be successful: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/fetchurl/builder.sh#L36

Or there could be more work on Nix's builtin fetchurl implementation.

peti commented 8 years ago

The build succeeds in the release-15.09 branch, too:

$ nix-build ~/.nix-defexpr -A rPackages.maps
/nix/store/6dn61i6ifdwnfsh7qz17qn177d54x4j6-r-maps-3.0.0-2

That command used revision 1a86bf8aae151c40747f4e47e791356ff0084e2b. I suppose this issue will go away after a channel update.

twhitehead commented 8 years ago

That does seem odd. Presuming you've found that

curl http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz

gives you a webpage instead of a 401 error? I really don't understand then. From what I can tell of the code it should do the following in order and stop on the first success

1- try every $url in the mirror list in the order of the mirror list with _$url/src/contrib/maps2.3-11.tar.gz 2- try every $url in the mirror list in the order of the mirror list with _$url/src/contrib/00Archive/maps/maps2.3-11.tar.gz

and this shouldn't work as when it tries _http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz_ it will think it succeeded because it gets the webpage instead of a 401. The build when the fail as the webpage won't match the hash.

What did you log say for the fetch? Mine looked like so

trying http://cran.r-project.org/src/contrib/maps_2.3-11.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (22) The requested URL returned error: 404 Not Found ... trying http://cran.stat.unipd.it/src/contrib/maps_2.3-11.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 837 100 837 0 0 3772 0 --:--:-- --:--:-- --:--:-- 3839

Cheers! -Tyson

peti commented 8 years ago

@twhitehead, please update your channel, i.e. run nix-channel --update. You are using an obsolete version of the R package set.