You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FS constants says not all constants are available on all platforms, but it doesn't say which ones are available on what platforms #41591
Not every constant will be available on every operating system.
However, this doesn't say anything else about the availability of various constants. In particular, none of the file mode constants are available on Windows and about half of the file type constants are also not present, but the docs don't even so much as hint at this. (I initially thought this to be a bug and filed #41590, so it's definitely confusing.) Part of what makes it non-obvious is the fact many of the various Unix-based constants (both in fs and elsewhere like with many signals) are shimmed on Windows in terms of corresponding Windows APIs, and so I can't just assume for all of them. (In particular, fs.constants.O_DIRECTORY is missing from Windows despite fs.opendir using Windows APIs similar to POSIX's opendir - that one was very surprising.)
Could the series of tables be updated to include platform availability for each relevant constant?
I've also got bitten by the missing S_IWUSR on Windows.
I think that this particular constant must be defined for Windows, since chmod() is able to set this bit; perhaps other constants are in this category too.
The constants not used on Windows can be omitted, but the documentation must explicitly mention this.
I added a small test to verify that the definitions are generated on Windows (the test passed), and I also added some explicit mentions in the documentation.
@ilg-ul Could you fix the description of #42757 such that it doesn't close this issue? It doesn't actually fix this as this extends well beyond those two constants.
Activity
ilg-ul commentedon Apr 14, 2022
I've also got bitten by the missing
S_IWUSRon Windows.I think that this particular constant must be defined for Windows, since
chmod()is able to set this bit; perhaps other constants are in this category too.The constants not used on Windows can be omitted, but the documentation must explicitly mention this.
bnoordhuis commentedon Apr 15, 2022
I've added the "good first issue" label because it just needs someone to go and open a pull request.
@ilg-ul
S_IWUSRis missing on Windows because it's called_S_IWRITEthere (which node doesn't export.)You could open a pull request exporting
_S_IWRITEand_S_IREAD, or aliasing them toS_IWUSRandS_IRUSR.ilg-ul commentedon Apr 15, 2022
I took a look, and I identified in
node_constants.ccseveral definitions that add constants. Is this the correct location?If so, I suggest we alias the definitions like this:
Is this what you mean?
bnoordhuis commentedon Apr 15, 2022
Yes, that would work. Variations of that pattern are already in use elsewhere in the code base.
ilg-ul commentedon Apr 15, 2022
I added a small test to verify that the definitions are generated on Windows (the test passed), and I also added some explicit mentions in the documentation.
ilg-ul commentedon Apr 15, 2022
The CI checks passed.
Do I have to do anything more, or simply wait for a review?
ilg-ul commentedon Apr 16, 2022
I created a new PR, hopefully cleaner: #42757.
dead-claudia commentedon Apr 18, 2022
@ilg-ul Could you fix the description of #42757 such that it doesn't close this issue? It doesn't actually fix this as this extends well beyond those two constants.
ilg-ul commentedon Apr 18, 2022
I replaced Fixes with Refs. Is this ok?
Btw, the patch also changes the documentation to mention which constants are available on Windows. Isn't this what you asked for?
dead-claudia commentedon Apr 18, 2022
@ilg-ul
I didn't realize that - didn't see it in the summary and I didn't actually look at the patch in question. In that case, this can be resolved by that.
ilg-ul commentedon Apr 18, 2022
You can also suggest a separate PR with explicit columns in that tables to show which constants are available for which platforms.
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win
src: define fs.constants.S_IWUSR & S_IRUSR for Win