Skip to content

Commit 72bb834

Browse files
authored
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: llvm/llvm-project#197104 Refs: #57103 Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: #66065 Reviewed-By: Xuguang Mei <meixuguang@gmail.com>
1 parent bd111f3 commit 72bb834

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎test/parallel/test-fs-rm.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,9 @@ if (isGitPresent) {
490490
// This test should not be run as `root`
491491
if (!common.isIBMi && (common.isWindows || process.getuid() !== 0)) {
492492
function makeDirectoryReadOnly(dir, allowExecute) {
493-
let accessErrorCode = 'EACCES';
494-
if (common.isMacOS && allowExecute) {
495-
accessErrorCode = 'ENOTEMPTY';
496-
}
493+
// With libc++ before LLVM 23 remove_all() reports the parent's ENOTEMPTY
494+
// over the child's EACCES: https://github.com/llvm/llvm-project/pull/197104
495+
let accessErrorCode = allowExecute ? /^(EACCES|ENOTEMPTY)$/ : 'EACCES';
497496
if (common.isWindows) {
498497
accessErrorCode = 'EPERM';
499498
const permissions = ['DE', 'DC'];

0 commit comments

Comments
 (0)