René's URL Explorer Experiment


Title: AIX: clang libc++ std::filesystem::remove_all() Returns Wrong Error Code · Issue #62790 · nodejs/node · GitHub

Open Graph Title: AIX: clang libc++ std::filesystem::remove_all() Returns Wrong Error Code · Issue #62790 · nodejs/node

X Title: AIX: clang libc++ std::filesystem::remove_all() Returns Wrong Error Code · Issue #62790 · nodejs/node

Description: Summary On AIX with clang/libc++, std::filesystem::remove_all() incorrectly returns error code 17 (EEXIST - "File exists") instead of 13 (EACCES - "Permission denied") when encountering permission errors during recursive directory remova...

Open Graph Description: Summary On AIX with clang/libc++, std::filesystem::remove_all() incorrectly returns error code 17 (EEXIST - "File exists") instead of 13 (EACCES - "Permission denied") when encountering permission ...

X Description: Summary On AIX with clang/libc++, std::filesystem::remove_all() incorrectly returns error code 17 (EEXIST - "File exists") instead of 13 (EACCES - "Permission denied") when enco...

Opengraph URL: https://github.com/nodejs/node/issues/62790

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"AIX: clang libc++ std::filesystem::remove_all() Returns Wrong Error Code","articleBody":"\n## Summary\nOn AIX with clang/libc++, `std::filesystem::remove_all()` incorrectly returns error code **17 (EEXIST - \"File exists\")** instead of **13 (EACCES - \"Permission denied\")** when encountering permission errors during recursive directory removal. This doesn't happen using gcc/libstdc++ on the same machine.\n**Note**: This bug only manifests when running as a **non-root user**. When run as root, the operation succeeds (no permission error occurs), so the bug is not triggered.\n\n## Environment\n\n### AIX (Bug Present)\n- **OS**: AIX 7.2\n- **Compiler**: clang version 20.1.7 (powerpc-ibm-aix7.2.0.0)\n- **Target**: powerpc-ibm-aix7.2.0.0\n- **Standard Library**: libc++\n\n### AIX with GCC (Correct Behavior)\n- **OS**: AIX 7.2\n- **Compiler**: GCC 12.3.0\n- **Standard Library**: libstdc++\n- **Result**: Bug does NOT occur with GCC on AIX\n\nAlso tested behavior on Linux:\n\n### Linux (Correct Behavior)\n- **OS**: Fedora 43\n- **Compiler**: clang version 20.1.8 (Fedora 20.1.8-2.fc43)\n- **Target**: x86_64-redhat-linux-gnu\n- **Standard Library**: libc++\n\n\n## Expected Behavior\nWhen `std::filesystem::remove_all()` fails due to insufficient permissions:\n- `error.value()` should be **13** (EACCES)\n- `error.message()` should be **\"Permission denied\"**\n- `error == std::errc::permission_denied` should be **true**\n\n## Actual Behavior on AIX\n- `error.value()` is **17** (EEXIST)\n- `error.message()` is **\"File exists\"**\n- `error == std::errc::permission_denied` is **false**\n\n**Note**: This bug only manifests when running as a **non-root user**. When run as root, the operation succeeds (no permission error occurs), so the bug is not triggered.\n\n## Impact\nThis bug causes applications to misinterpret permission errors as \"file exists\" errors, leading to incorrect error handling.\n\nThe Node.js test suite fails on AIX with clang due to this bug:\n\n**Test**: `parallel/test-fs-rm` (test case 1918)\n\n**Failure**:\n```\nnot ok 1918 parallel/test-fs-rm\n\nAssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:\n+ actual - expected\n\n  Comparison {\n+   code: '',\n-   code: 'EACCES',\n    name: 'Error'\n  }\n\nactual: Error: , Unknown error: File exists '/home/iojs/build/.tmp.1724/rm-11/fs-KFNaea'\n      at Object.rmSync (node:fs:1206:18)\n      ...\n      {\n    errno: -4094,\n    code: '',\n    path: '/home/iojs/build/.tmp.1724/rm-11/fs-KFNaea',\n    syscall: 'rm'\n  },\n  expected: { code: 'EACCES', name: 'Error' }\n```\n\nref: https://ci.nodejs.org/job/node-test-commit-aix-abmusse/21/nodes=test-ibm-aix72-ppc64_be-2/consoleText\n\n## Reproducer\n\n### Test Program\nSave the following as `test-clang-fs-removeall-bug.cpp`:\n\n```cpp\n/*\n * Bug: std::filesystem::remove_all() returns EEXIST instead of EACCES on AIX\n *\n * Expected: error.value() == 13 (EACCES - Permission denied)\n * Actual on AIX: error.value() == 17 (EEXIST - File exists)\n */\n\n#include \u003ciostream\u003e\n#include \u003cfilesystem\u003e\n#include \u003csystem_error\u003e\n#include \u003csys/stat.h\u003e\n#include \u003cerrno.h\u003e\n\nint main() {\n    // Create directory structure: root/middle/leaf\n    std::filesystem::create_directories(\"root/middle/leaf\");\n    \n    // Make middle read-only to trigger permission error\n    chmod(\"root/middle\", 0555);\n    \n    // Try to remove_all (should fail with permission error)\n    std::error_code error;\n    std::filesystem::remove_all(\"root\", error);\n    \n    // Report results\n    std::cout \u003c\u003c \"EACCES = \" \u003c\u003c EACCES \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"EEXIST = \" \u003c\u003c EEXIST \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"error.value() = \" \u003c\u003c error.value() \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"error.message() = \\\"\" \u003c\u003c error.message() \u003c\u003c \"\\\"\" \u003c\u003c std::endl;\n    std::cout \u003c\u003c \"error == std::errc::permission_denied: \"\n              \u003c\u003c (error == std::errc::permission_denied ? \"YES\" : \"NO\") \u003c\u003c std::endl;\n    \n    // Cleanup\n    chmod(\"root/middle\", 0755);\n    std::filesystem::remove_all(\"root\");\n    \n    return error.value() == EEXIST ? 1 : 0;  // Return 1 if bug is present\n}\n```\n\n### Compile and Run\n\n**On AIX (as non-root user):**\n```bash\n/opt/clang+llvm-20.1.7-powerpc64-ibm-aix-7.2/bin/clang++ -o test-clang-fs-removeall-bug.out test-clang-fs-removeall-bug.cpp\n./test-clang-fs-removeall-bug.out\n```\n\n**On Linux (as non-root user):**\n```bash\nclang++ -o test-clang-fs-removeall-bug.out test-clang-fs-removeall-bug.cpp\n./test-clang-fs-removeall-bug.out\n```\n\n**Note**: Must run as non-root user to trigger the permission error.\n\n### Output on Linux (clang 20.1.8 - Correct Behavior)\n```\nEACCES = 13\nEEXIST = 17\nerror.value() = 13\nerror.message() = \"Permission denied\"\nerror == std::errc::permission_denied: YES\n```\n\n### Output on AIX (clang 20.1.7 - Bug Present)\n```\nEACCES = 13\nEEXIST = 17\nerror.value() = 17\nerror.message() = \"File exists\"\nerror == std::errc::permission_denied: NO\n```\n\n**Verification**: This bug has been confirmed across multiple compilers and platforms:\n- **AIX with clang 20.1.7 + libc++**: Bug present (returns EEXIST instead of EACCES)\n- **Linux with clang 20.1.8 + libc++**: Bug NOT present (returns EACCES correctly)\n- **AIX with GCC 12.3.0 + libstdc++**: Bug NOT present (returns EACCES correctly)\n\nThis confirms the bug is **specific to clang's libc++ implementation on AIX**, not a general AIX filesystem issue or a general clang/libc++ bug. The same AIX system works correctly with GCC's libstdc++.\n\n## Root Cause Analysis\nThe bug appears to be in the AIX-specific implementation of `std::filesystem::remove_all()` in libc++. When the underlying system call (likely `rmdir()` or `unlink()`) fails with `errno = 13` (EACCES), the error is being incorrectly translated to `std::error_code` with value 17 (EEXIST).\n\nThis issue only occurs when running as a **non-root user** because:\n1. Root users bypass permission checks, so no EACCES error occurs\n2. Non-root users encounter permission errors when trying to remove read-only directories\n3. The bug in error code translation only manifests when EACCES is actually returned by the system\n\n## Workaround\n\n@richardlau  created a patch in Node.js to workaround this. \n\nref: https://github.com/nodejs/node/pull/62788\n\nCC \n\n@nodejs/platform-aix \n\nWe need to file this report to AIX compilers team too.","author":{"url":"https://github.com/abmusse","@type":"Person","name":"abmusse"},"datePublished":"2026-04-17T15:21:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/62790/node/issues/62790"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b71050ad-3e1a-08c9-76ce-5a5ccef7b58d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB92C:27C67C:16856A0:2079E99:6A4CEC09
html-safe-nonceb50714002941dec86b7af16eedc0b22722c3f3b300956d6f4a864415ce83ef1e
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTJDOjI3QzY3QzoxNjg1NkEwOjIwNzlFOTk6NkE0Q0VDMDkiLCJ2aXNpdG9yX2lkIjoiMzczNTQ1NDQ1MjA3MDI4MDIwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac1d0b0cab041e9f5bf4aa323e8fc79525985d6b992d5d8314c2d1b9f9ed70a21b
hovercard-subject-tagissue:4283634739
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/62790/issue_layout
twitter:imagehttps://opengraph.githubassets.com/10186d24306b626a63d9f3ec8973db187d95c25a468695e3efe5e9c1243c663e/nodejs/node/issues/62790
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/10186d24306b626a63d9f3ec8973db187d95c25a468695e3efe5e9c1243c663e/nodejs/node/issues/62790
og:image:altSummary On AIX with clang/libc++, std::filesystem::remove_all() incorrectly returns error code 17 (EEXIST - "File exists") instead of 13 (EACCES - "Permission denied") when encountering permission ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameabmusse
hostnamegithub.com
expected-hostnamegithub.com
None299b43bca6e02ad35197ffeba30d2466846d5fb02ab96fbced5b5e6cec589fb8
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasec5a57f04eeb310f57c73fd6d751d957e2ca27ed2
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/nodejs/node/issues/62790#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62790
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F62790
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/62790
Reloadhttps://github.com/nodejs/node/issues/62790
Reloadhttps://github.com/nodejs/node/issues/62790
Please reload this pagehttps://github.com/nodejs/node/issues/62790
nodejs https://github.com/nodejs
nodehttps://github.com/nodejs/node
Please reload this pagehttps://github.com/nodejs/node/issues/62790
Notifications https://github.com/login?return_to=%2Fnodejs%2Fnode
Fork 36k https://github.com/login?return_to=%2Fnodejs%2Fnode
Star 118k https://github.com/login?return_to=%2Fnodejs%2Fnode
Code https://github.com/nodejs/node
Issues 1.4k https://github.com/nodejs/node/issues
Pull requests 959 https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality 0 https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
Code https://github.com/nodejs/node
Issues https://github.com/nodejs/node/issues
Pull requests https://github.com/nodejs/node/pulls
Actions https://github.com/nodejs/node/actions
Projects https://github.com/nodejs/node/projects
Security and quality https://github.com/nodejs/node/security
Insights https://github.com/nodejs/node/pulse
AIX: clang libc++ std::filesystem::remove_all() Returns Wrong Error Codehttps://github.com/nodejs/node/issues/62790#top
aixIssues and PRs related to the AIX platform.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22aix%22
fsIssues and PRs related to the fs subsystem / file system.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22fs%22
https://github.com/abmusse
abmussehttps://github.com/abmusse
on Apr 17, 2026https://github.com/nodejs/node/issues/62790#issue-4283634739
https://ci.nodejs.org/job/node-test-commit-aix-abmusse/21/nodes=test-ibm-aix72-ppc64_be-2/consoleTexthttps://ci.nodejs.org/job/node-test-commit-aix-abmusse/21/nodes=test-ibm-aix72-ppc64_be-2/consoleText
@richardlauhttps://github.com/richardlau
#62788https://github.com/nodejs/node/pull/62788
aixIssues and PRs related to the AIX platform.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22aix%22
fsIssues and PRs related to the fs subsystem / file system.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22fs%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.