-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: define S_IWUSR & S_IRUSR for Windows #42748
Conversation
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. #41591
cc @nodejs/platform-windows @nodejs/libuv |
Please note that I do not have a Windows build environment available, and I could not check if this patch added the two definitions to fs.constants; this probably should be added to the tests, but I don't know how to do it. |
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. #41591
On Windows, most of the POSIX file mode definitions are not available. However, functionally equivalent read/write definitions exists, and `chmod()` can use them. This patch defines two aliases, so that these definintions are issued in `fs.constants`. refs: #41591
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some suggestions.
assert.ok(fs.constants.S_IRUSR !== undefined); | ||
assert.ok(fs.constants.S_IWUSR !== undefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be better to use assert.notStrictEqual()
here. The "is windows?" guard is better written as:
if (!common.isWindows)
common.skip('Windows-only test');
Although in its current incarnation it's not really Windows-specific. You could just remove the guard altogether and rename the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but could you please get rid of the merge commits? It negatively affects our tooling.
Oops! I thought it is something wrong :-( I'm using VS Code -> Amend. I should have used plain commit, right? |
If the mess creates any problems, we can abandon this PR and I can try to create a new one, hopefully cleaner. |
Any idea how I managed to break the ASan test? |
That looks like a flaky test, not anything caused by this PR. Apropos merge commits: |
Recreated as #42757. |
On Windows, most of the POSIX file mode definitions are not available.
However, functionally equivalent read/write definitions exists, and
chmod()
can use them. This patch defines two aliases, so that thesedefinintions are issued in
fs.constants
.Fixes: #41591