From 4e163941f330ff2cc4e7ae18a7845ca26f8ef45c Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 17 Apr 2024 14:16:13 -0700 Subject: [PATCH 1/4] [bundows] Skip unnecessary `GetFinalPathNameByHandle` --- src/sys.zig | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/sys.zig b/src/sys.zig index 457e309aae579e..552be100eff381 100644 --- a/src/sys.zig +++ b/src/sys.zig @@ -636,6 +636,24 @@ pub fn normalizePathWindows( }; } + if (std.mem.indexOfAnyPos(T, path_, &.{ '\\', '/', '.' }) == null) { + if (buf.len < path.len) { + return .{ + .err = .{ + .errno = @intFromEnum(bun.C.E.NOMEM), + .syscall = .open, + }, + }; + } + + // Skip the system call to get the final path name if it doesn't have any of the above characters. + @memcpy(buf[0..path.len], path); + buf[path.len] = 0; + return .{ + .result = buf[0..path.len :0], + }; + } + const base_fd = if (dir_fd == bun.invalid_fd) std.fs.cwd().fd else From 7189f6f98a3152b0ddc21caaec88cbc5bddb6cf9 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 17 Apr 2024 17:20:25 -0700 Subject: [PATCH 2/4] Update sys.zig --- src/sys.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sys.zig b/src/sys.zig index 552be100eff381..d67157626d455c 100644 --- a/src/sys.zig +++ b/src/sys.zig @@ -636,7 +636,7 @@ pub fn normalizePathWindows( }; } - if (std.mem.indexOfAnyPos(T, path_, &.{ '\\', '/', '.' }) == null) { + if (std.mem.indexOfAny(T, path_, &.{ '\\', '/', '.' }) == null) { if (buf.len < path.len) { return .{ .err = .{ From 3f1e7a65c7ee9cc6aba25daefc2cc5cebe081a8a Mon Sep 17 00:00:00 2001 From: Jarred-Sumner Date: Thu, 18 Apr 2024 00:23:22 +0000 Subject: [PATCH 3/4] Apply formatting changes --- test/harness.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/harness.ts b/test/harness.ts index a9d6276509785e..2d00ec8d631f01 100644 --- a/test/harness.ts +++ b/test/harness.ts @@ -20,8 +20,8 @@ export const bunEnv: NodeJS.ProcessEnv = { TZ: "Etc/UTC", CI: "1", BUN_RUNTIME_TRANSPILER_CACHE_PATH: "0", - BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: '1', - BUN_GARBAGE_COLLECTOR_LEVEL: process.env.BUN_GARBAGE_COLLECTOR_LEVEL || '0', + BUN_FEATURE_FLAG_INTERNAL_FOR_TESTING: "1", + BUN_GARBAGE_COLLECTOR_LEVEL: process.env.BUN_GARBAGE_COLLECTOR_LEVEL || "0", }; if (isWindows) { From 69b39c8860897090a2b2291aaad30d255ea8100a Mon Sep 17 00:00:00 2001 From: Jarred-Sumner Date: Tue, 23 Apr 2024 04:11:38 +0000 Subject: [PATCH 4/4] Apply formatting changes --- src/defines.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/src/defines.zig b/src/defines.zig index 740eb8e0557359..4565f0f06fbbae 100644 --- a/src/defines.zig +++ b/src/defines.zig @@ -315,4 +315,3 @@ pub const Define = struct { return define; } }; -