Skip to content

src: workaround AIX libc++ std::filesystem bug#62788

Merged
nodejs-github-bot merged 1 commit intonodejs:mainfrom
richardlau:aixclang
Apr 17, 2026
Merged

src: workaround AIX libc++ std::filesystem bug#62788
nodejs-github-bot merged 1 commit intonodejs:mainfrom
richardlau:aixclang

Conversation

@richardlau
Copy link
Copy Markdown
Member

@richardlau richardlau commented Apr 17, 2026

On AIX libc++ is returning EEXIST instead of EACCES when using std::filesystem::remove_all() without appropriate permissions to recursively remove the directory.

Refs: nodejs/build#4286 (comment)
Refs: #62790


When built on AIX with clang, we consistently hit this test failure in parallel/test-fs-rm:

bash-5.3$ ./tools/test.py --temp-dir /home/iojs/build/ parallel/test-fs-rm
=== release test-fs-rm ===
Path: parallel/test-fs-rm
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
/home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js:563
            throw err;
            ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected

  Comparison {
+   code: '',
-   code: 'EACCES',
    name: 'Error'
  }

    at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js:553:18)
    at Module._compile (node:internal/modules/cjs/loader:1829:14)
    at Object..js (node:internal/modules/cjs/loader:1969:10)
    at Module.load (node:internal/modules/cjs/loader:1552:32)
    at Module._load (node:internal/modules/cjs/loader:1354:12)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: Error: , Unknown error: File exists '/home/iojs/build/.tmp.0/rm-11/fs-LcfMea'
      at Object.rmSync (node:fs:1206:18)
      at assert.throws.code.code (/home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js:554:16)
      at getActual (node:assert:580:5)
      at assert.throws (node:assert:728:24)
      at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js:553:18)
      at Module._compile (node:internal/modules/cjs/loader:1829:14)
      at Object..js (node:internal/modules/cjs/loader:1969:10)
      at Module.load (node:internal/modules/cjs/loader:1552:32)
      at Module._load (node:internal/modules/cjs/loader:1354:12)
      at wrapModuleLoad (node:internal/modules/cjs/loader:255:19) {
    errno: -4094,
    code: '',
    path: '/home/iojs/build/.tmp.0/rm-11/fs-LcfMea',
    syscall: 'rm'
  },
  expected: { code: 'EACCES', name: 'Error' },
  operator: 'throws',
  diff: 'simple'
}

Node.js v26.0.0-pre
Command: out/Release/node --expose-internals /home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js


[00:11|% 100|+   0|-   1]: Done

Failed tests:
out/Release/node --expose-internals /home/iojs/build/workspace/node-test-commit-aix-abmusse/nodes/test-ibm-aix72-ppc64_be-2/test/parallel/test-fs-rm.js
bash-5.3$

@abmusse has done investigation that indicates this might be a libc++ on AIX bug (or at least difference). We'll try and pursue that as a longer term solution, but to unblock switching the AIX builds to clang this PR works around the difference.

@richardlau richardlau added fs Issues and PRs related to the fs subsystem / file system. aix Issues and PRs related to the AIX platform. labels Apr 17, 2026
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Apr 17, 2026
@richardlau
Copy link
Copy Markdown
Member Author

@nodejs-github-bot

This comment was marked as outdated.

@richardlau
Copy link
Copy Markdown
Member Author

Fighting linters 😢

On AIX libc++ is returning `EEXIST` instead of `EACCES` when using
`std::filesystem::remove_all()` without appropriate permissions to
recursively remove the directory.

Co-authored-by: Abdirahim Musse <abdirahim.musse@ibm.com>
Signed-off-by: Richard Lau <richard.lau@ibm.com>
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@abmusse abmusse self-requested a review April 17, 2026 15:05
@richardlau
Copy link
Copy Markdown
Member Author

CI with clang: https://ci.nodejs.org/job/node-test-commit-aix-abmusse/22/nodes=test-ibm-aix72-ppc64_be-2/console

This passed so should unblock switching AIX over to build with clang.

Copy link
Copy Markdown
Contributor

@abmusse abmusse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@sxa sxa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly odd behaviour but this sounds like a reasonable workaround.
Would be "interesting" (but not required for this to land) to see if the OS-provided libc on other AIX levels are affected including AIX 7.3 to understand if it may be worth reverting in the future sometime.

@richardlau richardlau added the fast-track PRs that do not need to wait for 72 hours to land. label Apr 17, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Fast-track has been requested by @richardlau. Please 👍 to approve.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.69%. Comparing base (4e612c0) to head (a649d24).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62788      +/-   ##
==========================================
- Coverage   89.69%   89.69%   -0.01%     
==========================================
  Files         706      706              
  Lines      218247   218247              
  Branches    41777    41773       -4     
==========================================
- Hits       195760   195752       -8     
- Misses      14401    14407       +6     
- Partials     8086     8088       +2     
Files with missing lines Coverage Δ
src/node_file.cc 74.52% <ø> (-0.08%) ⬇️

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@richardlau richardlau added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 17, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 17, 2026
@nodejs-github-bot nodejs-github-bot merged commit 5f02bdb into nodejs:main Apr 17, 2026
67 checks passed
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Landed in 5f02bdb

@richardlau richardlau deleted the aixclang branch April 17, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aix Issues and PRs related to the AIX platform. c++ Issues and PRs that require attention from people who are familiar with C++. fast-track PRs that do not need to wait for 72 hours to land. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants