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

resource missing at github.com ... jar.sha1, status: 404 Not Found #51

Open
milahu opened this issue May 8, 2022 · 0 comments
Open

Comments

@milahu
Copy link

milahu commented May 8, 2022

when building recaf, mvn2nix is trying to download

https://github.com/Col-E/jdk-tools-mirror/raw/master/repository/com/sun/tools/8.0/tools-8.0.jar.sha1

which fails, as github does not provide the virtual .sha1 file extension

cd Recaf
mvn org.nixos.mvn2nix:mvn2nix-maven-plugin:mvn2nix

[ERROR] Failed to execute goal org.nixos.mvn2nix:mvn2nix-maven-plugin:1.2.0:mvn2nix (default-cli) on project recaf: Downloading SHA-1 for com.sun:tools:jar:8.0: resource missing at https://github.com/Col-E/jdk-tools-mirror/raw/master/repository/com/sun/tools/8.0/tools-8.0.jar.sha1, status: 404 Not Found

looking at github's http headers ...

curl -L -I https://github.com/Col-E/jdk-tools-mirror/raw/master/repository/com/sun/tools/8.0/tools-8.0.jar
HTTP/2 302 
...

HTTP/2 200 
...
etag: "fee9a8876fd8450d592a8191c8f0ffae69225c6317cb53c2239debee475f577d"
...

sadly, github's etag is not a standard checksum

checksums
wget https://github.com/Col-E/jdk-tools-mirror/raw/master/repository/com/sun/tools/8.0/tools-8.0.jar
rhash tools-8.0.jar --all --bsd 
CRC32 (tools-8.0.jar) = b0059628
MD4   (tools-8.0.jar) = 6f02d0d19ccb9d9c8d424966e34d7e1e
MD5   (tools-8.0.jar) = d8283c643ac2e96343e9d70cd526cc2d
SHA1  (tools-8.0.jar) = da32e13e94097d207d33bf7cc4287bb8a682ca95
TIGER (tools-8.0.jar) = 64c9f07469c37adb99f9ad1ff2375731c88e721a319e4e40
TTH   (tools-8.0.jar) = wmuhx2ov7ajpkliasbwlpniuylnguzs3wncpguy
BTIH  (tools-8.0.jar) = 381fd04ee997eb0c0d01c48c9f1ed4758085ec3a
ED2K  (tools-8.0.jar) = a9e8dcf5599c6778794d068c6376f407
AICH  (tools-8.0.jar) = ktd6gv654ey46ce7rt547msgwxnvl4zr
WHIRLPOOL (tools-8.0.jar) = b98904c450c8ea722d3b5dfda598006833d3c305ff3392a3653c5a82ad9e6f76136624e5de2c68748b60687a1f6d449723970ce3a9964fa232df50b38a99c21d
RMD160 (tools-8.0.jar) = bd34735e8a4c4055f0e4322c41f6efe0886b75f3
GOST94 (tools-8.0.jar) = be338613d8c52c6210a720b12412119fb017d257fb9d683e988c17d854307e98
GOST94-CRYPTOPRO (tools-8.0.jar) = 248588cfdef96814ae855be18bd3ce40a5e39a6da13203cab53bd9267fd49cac
HAS-160 (tools-8.0.jar) = 4a09e2bde022a0a92675fe2acdd34992cdeaf2da
GOST12-256 (tools-8.0.jar) = 5b693f87359b6b98f1add5f1666d82141694e1bc9e8de930c061d9f29cfab787
GOST12-512 (tools-8.0.jar) = 48a22d956b15419feb15fe9f58c0a9ec955a49758e2aa7cc64ff108bc192fefa8bf10f5ccc357cef8200026ed4fe54c2799bfe8a928908aaa4aaaa793ff20125
SHA224 (tools-8.0.jar) = 693f98bc17a6e32bb319bc9516b8152d11ac6aae6265490412233765
SHA256 (tools-8.0.jar) = e1fce8282692948f301c26fd4245a4186f0c247e677aa85ce5076468c8d737b7
SHA384 (tools-8.0.jar) = 0f8e4a3a61b297e6c71352ab16e963831dd469f3b3486b35665a10b832f0915c57b18189ed9300385e70f7c464620289
SHA512 (tools-8.0.jar) = 545ec62279c1c83cc39d7f48762d8e724db5ed47ca2fa0917703c09fdb0a5af3c01793422f65f1cba196216507d7a958d61e4e9c9abd9527082e7fb1d95c433d
EDON-R256 (tools-8.0.jar) = 5b6d296645902cb40ba98205824ca76d19f8b9a5d612f93360edb5df00fc5742
EDON-R512 (tools-8.0.jar) = 891fb3c27b3eefbe551353e89452a348a5ac6a3e7083f58cf6b101938c01e7a5e15ed22947f3cc240d1f3b46f773e6b67d2db08795951335dfe0cee15c505724
SHA3-224 (tools-8.0.jar) = cfd0f17050c50ae8e9380597b0a9273fcbc6b7d9109772d1f307667e
SHA3-256 (tools-8.0.jar) = 43546370cdbe0a3e466803b9bc46cd22a97da1a9e006aeeacab17bc7e13e775a
SHA3-384 (tools-8.0.jar) = 361b7ae1aa1663fe3968ba68a7ef35efa5b3024c619c79c67c3667bd599be6b5d6220825650215e35892c09ecb908bf8
SHA3-512 (tools-8.0.jar) = e7d5ee6783945da08650881efbe63d422a0484fbf36a572734fd5e5d423d4b7f3090bada291bc65d8e03ba5c2f0f3f8e33b257edaddb8eb37594b3bf6fdf5ebc
CRC32C (tools-8.0.jar) = c952d8d3
SNEFRU-128 (tools-8.0.jar) = afc3f8ae554e0c7d3d71a6139ba009bd
SNEFRU-256 (tools-8.0.jar) = 68bd90da893d3bd3047aecfee0b53e8cdb3f557443cd53940e2754dbd86873b2
BLAKE2s (tools-8.0.jar) = a36a10684f2472c1194adb8e0b392da06a36b5392726009bb6a6da57d7dbc01f
BLAKE2b (tools-8.0.jar) = fb81ac5d4f15c747db185edcb87a6cd969ba232eb90a770ea3302fbfb9eefba5e3e5dc05c924364d0b9c164c9942b4e64fdea4369ceddf2d071b3cab3049d9c2

solutions

download the file, get the sha1/sha256 checksum

when mvn2nix sees a url like
https://github.com/Col-E/jdk-tools-mirror/raw/master/repository/com/sun/tools/8.0/tools-8.0.jar
it should also resolve master to the commit hash

fetch the git blob hash from the github api

blobHash=$(curl -s "https://api.github.com/repos/Col-E/jdk-tools-mirror/contents/repository/com/sun/tools/8.0/tools-8.0.jar?ref=master" | jq -r .sha)
# blobHash=8cbe563d5664f2a91a94743300abe5a7a6c2bf4f

curl -L -o tools-8.0.jar -H Accept: application/vnd.github.v3.raw https://api.github.com/repos/Col-E/jdk-tools-mirror/git/blobs/8cbe563d5664f2a91a94743300abe5a7a6c2bf4f

git hash-object tools-8.0.jar
# 8cbe563d5664f2a91a94743300abe5a7a6c2bf4f
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

No branches or pull requests

1 participant