Get bunx tests to pass on Windows (#9729)

* Get bunx tests to pass on Windows

* wip

* WIP

* wip

* wip

* ads

* asdf

* makeOpenPath

* almost revert

* fix build

* enoent

* fix bun install git repos

* cleanup

* use custom zig stdlib from submodule

* update dockerfile to copy zig stdlib sources

* fix dockerfile, update gitmodules

* fix dockerfile

* fix build

* fix build

* fix symlinkat

* fix build

* fix build

* Remove usages of unreachable

* Fixup

* Fixup

* wip

* fixup

* Fix one of the bugs

* asd

* Normalize BUN_INSTALL_CACHE_DIR var

* Set iterable to false when we're about to delete

* Update bun.zig

* I still can't repro this outside CI

* i think that fixes it?

* fix posix compile

* factor out directory creation

* update all install methods to use InstallDirState

* move walker creation to init function

* fix error cleanup

* fix posix compile

* all install tests pass locally

* cleanup

* [autofix.ci] apply automated fixes

* Fix posix regressions

---------

Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Co-authored-by: Meghan Denny <hello@nektro.net>
Co-authored-by: Georgijs Vilums <georgijs.vilums@gmail.com>
Co-authored-by: Georgijs <48869301+gvilums@users.noreply.github.com>
Co-authored-by: Georgijs Vilums <georgijs@bun.sh>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2024-04-03 20:53:28 -07:00
committed by GitHub
parent 76795af695
commit 00f27fbeec
32 changed files with 1418 additions and 792 deletions

View File

@@ -4365,7 +4365,9 @@ pub const NodeFS = struct {
) Maybe(Return.Mkdir) {
const VTable = struct {
pub fn onCreateDir(c: Ctx, dirpath: bun.OSPathSliceZ) void {
c.onCreateDir(dirpath);
if (Ctx != void) {
c.onCreateDir(dirpath);
}
return;
}
};
@@ -4812,7 +4814,7 @@ pub const NodeFS = struct {
const fd = switch (switch (Environment.os) {
else => Syscall.openat(atfd, basename, flags, 0),
// windows bun.sys.open does not pass iterable=true,
.windows => bun.sys.openDirAtWindowsA(atfd, basename, true, false),
.windows => bun.sys.openDirAtWindowsA(atfd, basename, .{ .no_follow = true, .iterable = true }),
}) {
.err => |err| {
if (comptime !is_root) {
@@ -5106,7 +5108,7 @@ pub const NodeFS = struct {
const fd = switch (switch (Environment.os) {
else => Syscall.open(path, flags, 0),
// windows bun.sys.open does not pass iterable=true,
.windows => bun.sys.openDirAtWindowsA(bun.toFD(std.fs.cwd().fd), path, true, false),
.windows => bun.sys.openDirAtWindowsA(bun.toFD(std.fs.cwd().fd), path, .{ .iterable = true }),
}) {
.err => |err| return .{
.err = err.withPath(args.path.slice()),
@@ -5360,7 +5362,7 @@ pub const NodeFS = struct {
const dirfd_path = buffer[0..dirfd_path_len];
const parent_path = bun.Dirname.dirname(u16, dirfd_path).?;
if (std.mem.startsWith(u16, parent_path, &bun.windows.nt_maxpath_prefix)) @constCast(parent_path)[1] = '?';
const newdirfd = switch (bun.sys.openDirAtWindows(bun.invalid_fd, parent_path, false, true)) {
const newdirfd = switch (bun.sys.openDirAtWindows(bun.invalid_fd, parent_path, .{ .no_follow = true })) {
.result => |fd| fd,
.err => |err| {
return .{ .err = err.withPath(path) };