diff --git a/src/bun.js/node/node_fs.zig b/src/bun.js/node/node_fs.zig index b1beeb9add..1ac5b31702 100644 --- a/src/bun.js/node/node_fs.zig +++ b/src/bun.js/node/node_fs.zig @@ -504,12 +504,6 @@ pub const AsyncReaddirRecursiveTask = struct { is_root, )) { .err => |err| { - // readdir() should never fail with 'ELOOP: Too many levels of symbolic links' - if (err.getErrno() == .LOOP) { - this.writeResults(ResultType, &entries); - return; - } - for (entries.items) |*item| { switch (ResultType) { bun.String => item.deref(), @@ -4973,8 +4967,6 @@ pub const NodeFS = struct { // This is different than what Node does, at the time of writing. // Node doesn't gracefully handle errors like these. It fails the entire operation. .NOENT, .NOTDIR, .PERM => continue, - // readdir() should never fail with 'ELOOP: Too many levels of symbolic links' - .LOOP => continue, else => { const path_parts = [_]string{ args.path.slice(), basename }; return .{ diff --git a/test/js/node/fs/fixtures/readdir-loop/a/b/c/d/e/f b/test/js/node/fs/fixtures/readdir-loop/a/b/c/d/e/f deleted file mode 120000 index c866b86874..0000000000 --- a/test/js/node/fs/fixtures/readdir-loop/a/b/c/d/e/f +++ /dev/null @@ -1 +0,0 @@ -../../../.. \ No newline at end of file diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts index 38c6aa0fc6..ac326e2ac7 100644 --- a/test/js/node/fs/fs.test.ts +++ b/test/js/node/fs/fs.test.ts @@ -8,7 +8,6 @@ import fs, { existsSync, mkdirSync, openSync, - readdir, readdirSync, readFile, readFileSync, @@ -3031,20 +3030,3 @@ it("promises.fdatasync with a bad fd should include that in the error thrown", a } expect.unreachable(); }); - -it("readdirSync should not crash on symlink loops", () => { - // prettier-ignore - expect(readdirSync(join(import.meta.dirname, "./fixtures/readdir-loop"), { recursive: true }).length).toBe(symlink_fixture_depth()); -}); - -it("readdir should not crash on symlink loops", async () => { - // prettier-ignore - expect((await promisify(readdir)(join(import.meta.dirname, "./fixtures/readdir-loop"), { recursive: true })).length).toBe(symlink_fixture_depth()); -}); - -function symlink_fixture_depth() { - if (process.platform === "darwin") return 166; - if (process.platform === "linux") return 206; - if (process.platform === "win32") return 6; - throw new Error(`test unimplemented for '${process.platform}'`); -}