Checksum command generates incorrect Github URLs
The checksum command generates URLs that appear to be a combination of the releases and archive URL.
Steps to reproduce the issue
~$ spack checksum star
==> Found 12 versions of star:
2.7.3a https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.3a.tar.gz
2.7.2d https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.2d.tar.gz
2.7.2c https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.2c.tar.gz
2.7.2b https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.2b.tar.gz
2.7.2a https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.2a.tar.gz
2.7.1a https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.1a.tar.gz
2.7.0f https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.0f.tar.gz
2.7.0e https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.0e.tar.gz
2.7.0d https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.0d.tar.gz
...
2.4.2a https://github.com/alexdobin/STAR/archive/STAR_2.4.2a.tar.gz
The expected URL would be:
https://github.com/alexdobin/STAR/archive/2.7.3a.tar.gz
Error Message
==> Downloading...
==> Fetching https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.3a.tar.gz
##O=-# #
curl: (22) The requested URL returned error: 404 Not Found
==> Fetching from https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.3a.tar.gz failed.
==> Something failed on https://github.com/alexdobin/STAR/releases/alexdobin/STAR/archive/2.7.3a.tar.gz, skipping.
(All fetchers failed for spack-stage-wylazepo)
==> Error: Could not fetch any versions for star
Information on your system
~$ spack --version
0.13.0
This bug seems to affect ALL packages that download from GitHub. Packages that download from a separately uploaded releases tarball are even worse:
$ spack checksum mercury
==> Found 4 versions of mercury:
1.0.1 https://github.com/mercury-hpc/mercury/releases/mercury-hpc/mercury/releases/download/v1.0.1/mercury-1.0.1.tar.bz2
1.0.0rc1 https://github.com/mercury-hpc/mercury/releases/mercury-hpc/mercury/releases/download/v1.0.0rc1/mercury-1.0.0rc1.tar.bz2
1.0.0 https://github.com/mercury-hpc/mercury/releases/mercury-hpc/mercury/releases/download/v1.0.0/mercury-1.0.0.tar.bz2
0.9.0 https://github.com/mercury-hpc/mercury/releases/mercury-hpc/mercury/releases/download/v0.9.0/mercury-0.9.0.tar.bz2
==>
==> How many would you like to checksum? (default is 1, q to abort)
Somehow this doesn't affect fetching, only spack checksum. I'll take a look.
Bug affects both Python 2 and 3.
Bug does not affect spack checksum star 2.7.3a.
Bug seems to occur in the following call stack:
spack.package.fetch_remote_versionsspack.util.web.find_versions_of_archivespack.util.web.spiderspack.util.web._spiderspack.util.url.join
It looks like this bug was introduced by #11117, which was merged 7 days ago. Since this PR is relatively fresh and I'm not that familiar with this particular section of code, I'm going to ask the #11117 developers/reviewers to investigate this one.
@opadron @scheibelp @scottwittenburg @eugeneswalker @paulbry @tgamblin @gartung
While you're at it, maybe one of you can figure out a way to resolve #11680/#11682, which is a similar symptom but completely unrelated illness.
This also affects spack create or any other command using this mechanism
spack create https://github.com/sharkdp/bat/archive/v0.12.1.tar.gz
==> This looks like a URL for bat
==> Found 38 versions of bat:
0.12.1-i686-unknown-linux-gnu https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-i686-unknown-linux-gnu.tar.gz
0.12.1-arm-unknown-linux-gnueabihf https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-arm-unknown-linux-gnueabihf.tar.gz
0.12.1-aarch64-unknown-linux-gnu https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-aarch64-unknown-linux-gnu.tar.gz
0.12.1 https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-x86_64-unknown-linux-musl.tar.gz
0.12.0-i686-unknown-linux-gnu https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.0/bat-v0.12.0-i686-unknown-linux-gnu.tar.gz
0.12.0-arm-unknown-linux-gnueabihf https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.0/bat-v0.12.0-arm-unknown-linux-gnueabihf.tar.gz
0.12.0-aarch64-unknown-linux-gnu https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.0/bat-v0.12.0-aarch64-unknown-linux-gnu.tar.gz
0.12.0 https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.0/bat-v0.12.0-x86_64-unknown-linux-musl.tar.gz
0.11.0-i686-unknown-linux-gnu https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.11.0/bat-v0.11.0-i686-unknown-linux-gnu.tar.gz
...
0.6.0 https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.6.0/bat-v0.6.0-x86_64-unknown-linux-musl.tar.gz
==>
==> How many would you like to checksum? (default is 1, q to abort) 1
==> Downloading...
==> Fetching https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-i686-unknown-linux-gnu.tar.gz
##O=-# #
curl: (22) The requested URL returned error: 404 Not Found
==> Fetching from https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-i686-unknown-linux-gnu.tar.gz failed.
==> Something failed on https://github.com/sharkdp/bat/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-i686-unknown-linux-gnu.tar.gz, skipping.
(All fetchers failed for spack-stage-ho66_u5s)
==> Error: Could not fetch any versions for bat
The dictionary of pages generated as part of spack.util.web._spider looks to be incorrect:
{'https://github.com/sstephenson/bats/releases/sstephenson/bats/releases/tag/v0.4.0', ... }
I'm looking into this issue and will update, here.
So far, I have determined that the logic for spack.util.url.join doesn't account for absolute links (e.g.: join('https://github.com/mercury-hpc/mercury/releases/download/v1.0.1', '/mercury-hpc/mercury/...'))
I am preparing a fix to handle this and similar cases.
There may be other issues that I have yet to identify.
@erimar77 @adamjstewart @paulbry please have a look at #13488.
Also, I haven't yet made the determination that #13488 is the only fix needed to address this issue. I'd like to keep this issue opened, even if #13488 is merged. Is there a way to tell github not to auto-close this issue?
@opadron #13488 resolves the issues I've been experiencing.
Is there a way to tell github not to auto-close this issue?
Yes, simply avoid these keywords: https://help.github.com/en/github/managing-your-work-on-github/closing-issues-using-keywords
Just following up on one last point:
I was worried that there might have been more fixes needed to address this issue, but after merging #13488, I am less concerned. I think we can keep this issue closed and follow up with a new issue if something new is discovered.
I still cannot fetch/install not yet checksummed versions.
$ spack fetch --no-checksum [email protected]
==> Error: Version('1.9.5')
@zzotta: that's a separate error -- it means [email protected] couldn't concretize. But we should be asking whether the user wants to download that instead of raising a cryptic error.
If I run that with spack -d:
Traceback (most recent call last):
File "/Users/gamblin2/src/spack/bin/spack", line 64, in <module>
sys.exit(spack.main.main())
File "/Users/gamblin2/src/spack/lib/spack/spack/main.py", line 715, in main
return _invoke_command(command, parser, args, unknown)
File "/Users/gamblin2/src/spack/lib/spack/spack/main.py", line 457, in _invoke_command
return_val = command(parser, args)
File "/Users/gamblin2/src/spack/lib/spack/spack/cmd/fetch.py", line 57, in fetch
package.do_fetch()
File "/Users/gamblin2/src/spack/lib/spack/spack/package.py", line 1079, in do_fetch
self.stage.create()
File "/Users/gamblin2/src/spack/lib/spack/spack/package.py", line 806, in stage
self._stage = self._make_stage()
File "/Users/gamblin2/src/spack/lib/spack/spack/package.py", line 783, in _make_stage
stage = self._make_root_stage(fetcher)
File "/Users/gamblin2/src/spack/lib/spack/spack/package.py", line 761, in _make_root_stage
self.spec)
File "/Users/gamblin2/src/spack/lib/spack/spack/mirror.py", line 309, in mirror_archive_paths
ext = spec.package.versions[spec.package.version].get(
KeyError: Version('1.9.5')
The error is coming from here mirror_archive_paths, on a line introduced in #12940:
4af448724f (Peter Scheibel 2019-10-25 21:47:28 -0700 308) if spec:
4af448724f (Peter Scheibel 2019-10-25 21:47:28 -0700 309) ext = spec.package.versions[spec.package.version].get(
4af448724f (Peter Scheibel 2019-10-25 21:47:28 -0700 310) 'extension', None)
So that is a separate issue... lemme see if I can make a quick fix.