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

Opam admin cache doesn't create a symlink for sha256 to sha512 #6064

Closed
psafont opened this issue Jul 2, 2024 · 10 comments · Fixed by #6068
Closed

Opam admin cache doesn't create a symlink for sha256 to sha512 #6064

psafont opened this issue Jul 2, 2024 · 10 comments · Fixed by #6068

Comments

@psafont
Copy link

psafont commented Jul 2, 2024

I've run into a couple issues when building xapi's opam repository as an RPM in an environment without internet access:

  1. When running opam admin cache in opam 2.2.0, the sha256 file for crc.2.2.0 is not created, only the sha512 one. The former should a symlink to the latter.
  2. When installing the crc.2.2.0 package, opam 2.1.4 finds that there is no file for its sha256 hash and tries to use internet do fetch it. First from opam.ocaml.org, and after with github.com, after which it fails. I believe it should try to use the sha512 hash to fetch the file from the cache before using other sources.

I'm updating the opam version for issue 2. to see if this behaviour has changed. In any case I've been able to work around issue 1 by manually creating the symlink in the sha256 folder to the sha512 file. Another workaround is removing the sha512 hash from the checksum list: it makes opam create the file created correctly in the sha256 folder.

I don't quite understand why this is the only package in the whole repository with this behaviour, but it looks like a bug.

@kit-ty-kate
Copy link
Member

kit-ty-kate commented Jul 2, 2024

Has issue 2 been fixed in opam 2.1.5 by #5538 ?

@psafont
Copy link
Author

psafont commented Jul 2, 2024

I'll test building an opam 2.1.6 rpm to be used in the build

@psafont
Copy link
Author

psafont commented Jul 2, 2024

I've made a github runner to package a repo tarball, it uses ubuntu's opam package: 2.1.2. The resulting tarball contains the file in the sha256 folder, but not a file in the sha512 folder:
https://github.com/xapi-project/xs-opam/releases/tag/6.81.0
https://github.com/xapi-project/xs-opam/actions/runs/9763086989/job/26948098641#step:5:1

@psafont
Copy link
Author

psafont commented Jul 3, 2024

I've retried building the package with 2.1.6 and issue 2 still happens. Building opam 2.2.0 requires some changes, so it will take some time to test whether it's affected

@kit-ty-kate
Copy link
Member

Actually I'm getting the same problem with opam 2.2.0 while using https://github.com/kit-ty-kate/opam-health-check-ng, which means a large number of packages fail and I'm unable to check them.

I'm looking into it.

@rjbou
Copy link
Collaborator

rjbou commented Jul 3, 2024

Do you have a previously populated cache or it is an new one?
Opam creates the symlinks, taking the strongest checksum as real archive and creates links to that one for others checksums.
In the case where the cache is already present, especially if the strongest checksum archive file is already present it can alter this mechanism.

@psafont
Copy link
Author

psafont commented Jul 3, 2024

Do you have a previously populated cache or it is an new one?

I can reproduce this locally starting from an empty cache. It's strange this only seems to happen for a single package in the repository.

@kit-ty-kate
Copy link
Member

we managed to found the issue and fix it in #6068. We still need to figure out if the fix doesn't introduce any performance issues but at least it's being actively worked on.

@psafont
Copy link
Author

psafont commented Sep 27, 2024

I've tested the tarballing with the new 2.3.0 alpha, and can confirm that it builds without issues now, thanks!

@rjbou
Copy link
Collaborator

rjbou commented Sep 27, 2024

Thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants