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

System package mode does not work with legacy package hashes #23060

Closed
BratishkaErik opened this issue Mar 3, 2025 · 4 comments
Closed

System package mode does not work with legacy package hashes #23060

BratishkaErik opened this issue Mar 3, 2025 · 4 comments
Labels
bug Observed behavior contradicts documented or intended behavior

Comments

@BratishkaErik
Copy link
Contributor

Zig Version

0.14.0-dev.3460+6d29ef0ba

Steps to Reproduce and Observed Behavior

Hello, after #22994 was merged, system package retrieval no longer works with dependencies which were not updated to the new format.

For example you can checkout zigtools/zls@336f468 and run following commands:

$ zig build
# works fine
$ zig build --fetch --global-cache-dir deps/
$ zig build --system deps/p/                
/home/bratishkaerik/github.com/zls/build.zig.zon:21:14: error: package not found at 'deps/p//1220102cb2c669d82184fb1dc5380193d37d68b54e8d75b76b2d155b9af7d7e2e76d'
            .hash = "1220102cb2c669d82184fb1dc5380193d37d68b54e8d75b76b2d155b9af7d7e2e76d",
             ^~~~
$ exa --tree -L1 deps/p/
deps/p
├── known_folders-0.0.0-Fy-PJtLDAADGDOwYwMkVydMSTp_aN-nfjCZw6qPQ2ECL
├── lsp_codegen-0.1.0-CMjjo0ZXCQB-rAhPYrlfzzpU0u0u2MeGvUucZ-_g32eg
└── N-V-__8AABhrAQAQLLLGadghhPsdxTgBk9N9aLVOjXW3ay0V

Note that it does not error when you re-fetch this dependency to get hash saved in new format:

         .diffz = .{
             .url = "https://github.com/ziglibs/diffz/archive/ef45c00d655e5e40faf35afbbde81a1fa5ed7ffb.tar.gz",
-            .hash = "1220102cb2c669d82184fb1dc5380193d37d68b54e8d75b76b2d155b9af7d7e2e76d",
+            .hash = "N-V-__8AABhrAQAQLLLGadghhPsdxTgBk9N9aLVOjXW3ay0V",
         },

Expected Behavior

To work like it does for regular builds. If they are still allowed for regular builds, I would expect them to work with system mode too.

... or be banned in both scenarios. With current model, to fix system mode you would need to convert every hash of every dependency (direct or transient) anyway.

@BratishkaErik BratishkaErik added the bug Observed behavior contradicts documented or intended behavior label Mar 3, 2025
@alexrp
Copy link
Member

alexrp commented Mar 3, 2025

#23051?

@BratishkaErik
Copy link
Contributor Author

BratishkaErik commented Mar 3, 2025

#23051?

It says:

Suggested workaround: upgrade to new hash format
Alternate workaround: use zig-0.13.0 to zig fetch legacy packages

Second one would not work with zig build --fetch/--help (which is used for fetching in live/Git-HEAD packages for Gentoo).

First one requires me to patch all packages' build.zig.zon when they have legacy hashes, or ping upstream maintainers to do this (which kinda weakens point of compatibility IMHO).

@nektro
Copy link
Contributor

nektro commented Mar 3, 2025

the compatibility kept is only that if u already have the files downloaded then it would continue to work.

First one requires me to patch all packages' build.zig.zon when they have legacy hashes, or ping upstream maintainers to do this

this interpretation is also my understanding and unlikely to be changed since a system packaging environment is going to always be a cold cache

@andrewrk
Copy link
Member

andrewrk commented Mar 3, 2025

Please make an argument for reopening #23051

@andrewrk andrewrk closed this as completed Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

4 participants