Using zap with BTRFS on Linux 6.5.0 causes a package hash mismatch
Versions: zig 0.11.0 zap 0.1.14-pre
Steps to reproduce:
- Create a new zig project with
zig init-exe - Create a build.zig.zon file from the example in the README:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap v0.1.14-pre
.zap = .{
.url = "https://github.com/zigzap/zap/archive/refs/tags/v0.1.14-pre.tar.gz",
.hash = "122067d12bc7abb93f7ce623f61b94cadfdb180cef12da6559d092e6b374202acda3",
}
}
}
- Clear zig cahce e.g run
rm -rf ~/.cache/zig/on linux - Run
zig build run
Output:
Fetch Packages [1/1] zap... /home/marcus/Downloads/b/build.zig.zon:9:21: error: hash mismatch: expected: 122067d12bc7abb93f7ce623f61b94cadfdb180cef12da6559d092e6b374202acda3, found: 12202d26b8c618b661ac5c9f96c11926f931fbea6afd302b7e71df9b3d256e79db91
.hash = "122067d12bc7abb93f7ce623f61b94cadfdb180cef12da6559d092e6b374202acda3",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If i use the hash 12202d26b8c618b661ac5c9f96c11926f931fbea6afd302b7e71df9b3d256e79db91 instead i get another hash mismatch:
Fetch Packages [2/2] zap.facil.io... /home/marcus/.cache/zig/p/12202d26b8c618b661ac5c9f96c11926f931fbea6afd302b7e71df9b3d256e79db91/build.zig.zon:8:21: error: hash mismatch: expected: 12200301960bbde64052db068cf31a64091ce1f671898513d9b8d9e2be5b0e4b13a3, found: 12206956e1c8e1af5fd28e44d534e4e131299545fa0676e1edc04bf02eb2185e266a
.hash = "12200301960bbde64052db068cf31a64091ce1f671898513d9b8d9e2be5b0e4b13a3",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I hope I'm not taking this issue on a tangent, but do you happen to be using Linux >6.4.12 with a BTRFS filesystem. I had nearly identical symptoms with a different package. Downgrading my kernel fixed the issue for me. For reference: ziglang/zig#17095
I am using BTRFS on Linux 6.5.0 so this almost guaranteed to be the issue, i was unaware of the broader issue with BTRFS on certain 6.4.x and 6.5.x releases of linux.
There are two workarounds for this issue:
- Use a kernel that is not in the > 6.4.12 && < 6.5.6 range (my fix)
- If using zig master set
ZIG_BTRFS_WORKAROUND=1
See for more info: IterableDir does not iterate over all contents created after opening (Linux BTRFS) package manager: Transitive dependencies have incorrect hash
@renerocksai should this issue be closed since it has now been resolved for me or should it remain open for others refrance?
@MarcusWagberg I'll better keep it open until zig 0.12.0 arrives.