zig icon indicating copy to clipboard operation
zig copied to clipboard

Hash mismatch error should suggest the "N-V-__" format, not the legacy format

Open silbinarywolf opened this issue 2 months ago • 0 comments

Zig Version

0.15.2

Steps to Reproduce and Observed Output

Related to: www.github.com/ziglang/zig/issues/23051#issuecomment-2701839979

How to reproduce:

  1. Use Zig 0.15.2 and download this example project: example-zig.zip
  2. Run zig build
  3. See output like:
D:\ZigProjects\example-zig\build.zig.zon:9:21: error: hash mismatch: manifest declares '12201d54a5eb828abc4dfef3c9eeee16d31a29fd58066d5060f377967cd0554b2951' but the fetched package has '12201d54a5eb828abc4dfef3c9eeee16d31a29fd58066d5060f377967cd0554b2954'
            .hash = "12201d54a5eb828abc4dfef3c9eeee16d31a29fd58066d5060f377967cd0554b2951",

Expected Output

I expect to the hash mismatch to match zig fetch behaviour:

D:\ZigProjects\example-zig\build.zig.zon:9:21: error: hash mismatch: manifest declares '12201d54a5eb828abc4dfef3c9eeee16d31a29fd58066d5060f377967cd0554b2951' but the fetched package has 'N-V-__8AAFcztQQdVKXrgoq8Tf7zye7uFtMaKf1YBm1QYPN3'
            .hash = "12201d54a5eb828abc4dfef3c9eeee16d31a29fd58066d5060f377967cd0554b2951",

Example of calling zig fetch:

$ zig fetch https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.32.10.zip
N-V-__8AAFcztQQdVKXrgoq8Tf7zye7uFtMaKf1YBm1QYPN3

I've honestly just thought that the Zig dependency manager was broken for non-Zig projects since this change happened, as my approach to updating external dependencies was to:

  • Update to the version of the dependency in the URL
  • Break the hash on purpose by adjusting a number at the end
  • Update to the new suggested hash after updating my build.zig.zon file and running zig build

silbinarywolf avatar Nov 19 '25 01:11 silbinarywolf