blob: 2d2dc22a375a9654d2c59982b1cbae5915c49921 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# https://github.com/ziglang/zig/pull/20001
# https://github.com/Jiboo/zig/commit/856fe4af
Author: Jean-Baptiste "Jiboo" Lepesme <lepesme.jb@gmail.com>
Date: Sun, 19 May 2024 15:02:42 +0200
IoUring: fix an issue in tests where InvalidVersion might get thrown by
skipKernelLessThan, due to some kernel versions not being SemVer compliant.
diff --git a/lib/std/os/linux/IoUring.zig b/lib/std/os/linux/IoUring.zig
index 3bf3c077fc3b..b2a4da486907 100644
--- a/lib/std/os/linux/IoUring.zig
+++ b/lib/std/os/linux/IoUring.zig
@@ -3883,7 +3883,13 @@ inline fn skipKernelLessThan(required: std.SemanticVersion) !void {
}
const release = mem.sliceTo(&uts.release, 0);
- var current = try std.SemanticVersion.parse(release);
+ // Strips potential extra, as kernel version might not be semver compliant, example "6.8.9-300.fc40.x86_64"
+ const extra_index = std.mem.indexOfAny(u8, release, "-+");
+ const stripped = release[0..(extra_index orelse release.len)];
+ // Make sure the input don't rely on the extra we just stripped
+ try testing.expect(required.pre == null and required.build == null);
+
+ var current = try std.SemanticVersion.parse(stripped);
current.pre = null; // don't check pre field
if (required.order(current) == .gt) return error.SkipZigTest;
}
|