From 8d19a6c6713c878f4d9fc062977a7b43bff961d5 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 16 Sep 2026 10:36:11 +0000 Subject: [PATCH] test: accept ENOTEMPTY from libc++ in test-fs-rm fs.rmSync() is implemented with std::filesystem::remove_all(). When a read-only directory has a child, libc++ before LLVM 23 drops the child's EACCES and reports the ENOTEMPTY it then gets for the parent instead. The test pinned that behavior to macOS, but it depends on the C++ standard library rather than on the OS: a Linux build against libc++ fails the test when run as non-root, and macOS will start reporting EACCES once it ships the fixed libc++. Accept either code for that case on all POSIX platforms. Refs: https://github.com/llvm/llvm-project/pull/197104 Refs: https://github.com/nodejs/node/pull/57103 Signed-off-by: Shelley Vohr --- test/parallel/test-fs-rm.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-fs-rm.js b/test/parallel/test-fs-rm.js index 1d0578e3004d..80600d114b9a 100644 --- a/test/parallel/test-fs-rm.js +++ b/test/parallel/test-fs-rm.js @@ -490,10 +490,9 @@ if (isGitPresent) { // This test should not be run as `root` if (!common.isIBMi && (common.isWindows || process.getuid() !== 0)) { function makeDirectoryReadOnly(dir, allowExecute) { - let accessErrorCode = 'EACCES'; - if (common.isMacOS && allowExecute) { - accessErrorCode = 'ENOTEMPTY'; - } + // With libc++ before LLVM 23 remove_all() reports the parent's ENOTEMPTY + // over the child's EACCES: https://github.com/llvm/llvm-project/pull/197104 + let accessErrorCode = allowExecute ? /^(EACCES|ENOTEMPTY)$/ : 'EACCES'; if (common.isWindows) { accessErrorCode = 'EPERM'; const permissions = ['DE', 'DC'];