From 157cf448717fe64ad6b97cced65405e515aa0610 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 26 Oct 2026 16:14:40 -0700 Subject: [PATCH] fix version checking --- build/GitVersion.zig | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build/GitVersion.zig b/build/GitVersion.zig index e5dbf59..ba1fdd3 100644 --- a/build/GitVersion.zig +++ b/build/GitVersion.zig @@ -64,8 +64,11 @@ pub fn getVersion(b: *Build, options: Options) []const u8 { fn findBuildRoot(allocator: std.mem.Allocator, io: std.Io) ![]const u8 { var buf: [std.fs.max_path_bytes]u8 = undefined; - // `realPath` now returns the length written rather than a slice. - const start_len = try std.Io.Dir.cwd().realPath(io, &buf); + // Not `Dir.cwd().realPath`: on Linux that resolves the handle through + // `/proc/self/fd/{fd}`, and `Dir.cwd()` is the `AT_FDCWD` sentinel (-100) + // rather than a real descriptor, so it always fails with `FileNotFound`. + // That silently turned every version string into "unknown". + const start_len = try std.process.currentPath(io, &buf); var cwd: []const u8 = buf[0..start_len]; while (true) {