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) {