-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Package hash differs on multiple machines #17064
Comments
Since these issues can be unrelated, it may be better to open a distinct issue. Getting different results at different optimization levels is usually due to code relying on undefined behaviors, so maybe double check that your code doesn't return pointers to stack-allocated buffers, freed buffers, etc. |
This was driving me crazy, but it was a skill issue in the end. My function was returning a slice of a stack-allocated array. |
I noticed hash inconsistencies on my Linux machine (using Zig It seems that on my system, the directory handle returned by const std = @import("std");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var dir = try std.fs.cwd().makeOpenPathIterable("test", .{});
defer dir.close();
try dir.dir.writeFile("1", "1");
try dir.dir.writeFile("2", "2");
var walker = try dir.walk(allocator);
defer walker.deinit();
while (try walker.next()) |entry| {
std.debug.print("{s} {}\n", .{ entry.path, entry.kind });
}
} On my system, this prints only one entry ( The same pattern applies to the logic used in If this is valid behavior for |
Seems like very undesirable/unintended behavior at the very least. I'd suggest opening a new issue for this. |
Are you sure this is not Github's fault? The archive link is not stable. |
The package hash is computed from the unpacked files on disk. The hash of the tarball itself does not matter. If GitHub is not mutating the actual file content, or deleting files, then the hash according to zig will be unchanged. |
@andrewrk there is another interesting behavior. If the hash doesn't change, and you change the url, Zig will keep using the cached file. e.g.
This behavior is surprising. |
Zig Version
0.12.0-dev.262+3cf71580c
Steps to Reproduce and Observed Behavior
git clone https://github.com/LittleBigRefresh/FreshPresence
cd FreshPresence
zig build
on my windows arm64 devkit
on my main linux desktop
my desktop thinks the hash is
...3952
while the windows arm64 machine thinks the hash is...b01e
Expected Behavior
Both machines should successfully download and verify dependencies
Notes
original discord convo
The text was updated successfully, but these errors were encountered: