Repository navigation
Behavior of realpath with an empty string argument #53635
Description
Activity
- addedfsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module.discussIssues opened for discussion and feedback.Issues opened for discussion and feedback.
on Jun 28, 2024 There is always going to be a discrepency between
fs.realpath()andfs.promises.realpath().For some history
fs.realpath()andfs.realpathSync()differ from nativerealpathand have behaviour oddities that were too breaking to change. At one point it was changed to call the nativerealpathbut there were a number of issues that resulted in the implementation being reverted, see #7726.When
fs.promises.realpath()was added the decision was made to call the nativerealpathsince it was a new API and be consistent withfs.realpath.native().Reacted by Benjamin Gruenbaum and Tobias NießenI'm aware that there historically have been discrepency, but I think that the discrepencies (for errors) should be handled, or noted in the docs.
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on May 8, 2026 This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 240 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
Refs: #35403
Currently, the project has 2 outcomes for different
realpathfunctions with empty string arguments:IMO, this should be standardized to
(A) Always throw
(B) Always return CWD
(C) Return CWD for non-
.nativecalls, throw otherwise