-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
FS constants says not all constants are available on all platforms, but it doesn't say which ones are available on what platforms #41591
Comments
I've also got bitten by the missing I think that this particular constant must be defined for Windows, since The constants not used on Windows can be omitted, but the documentation must explicitly mention this. |
I've added the "good first issue" label because it just needs someone to go and open a pull request. @ilg-ul You could open a pull request exporting |
I took a look, and I identified in If so, I suggest we alias the definitions like this: #if defined(_WIN32)
#include <io.h> // _S_IREAD _S_IWRITE
#ifndef S_IRUSR
#define S_IRUSR _S_IREAD
#endif // S_IRUSR
#ifndef S_IWUSR
#define S_IWUSR _S_IWRITE
#endif // S_IWUSR
#endif Is this what you mean? |
Yes, that would work. Variations of that pattern are already in use elsewhere in the code base. |
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. |
The CI checks passed. Do I have to do anything more, or simply wait for a review? |
I created a new PR, hopefully cleaner: #42757. |
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? |
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. |
You can also suggest a separate PR with explicit columns in that tables to show which constants are available for which platforms. |
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. fixes: nodejs#41591 PR-URL: nodejs#42757 Refs: nodejs#41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: #41591 PR-URL: #42757 Refs: #41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: #41591 PR-URL: #42757 Refs: #41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: #41591 PR-URL: #42757 Refs: #41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: #41591 PR-URL: #42757 Refs: #41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: #41591 PR-URL: #42757 Refs: #41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
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. fixes: nodejs/node#41591 PR-URL: nodejs/node#42757 Refs: nodejs/node#41591 Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: James M Snell <[email protected]>
Affected URL(s)
https://nodejs.org/api/fs.html#fsconstants
Description of the problem
It says the following:
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 despitefs.opendir
using Windows APIs similar to POSIX'sopendir
- that one was very surprising.)Could the series of tables be updated to include platform availability for each relevant constant?
The text was updated successfully, but these errors were encountered: