-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Mention case-insensitivity in process.env docs #9157
Comments
It might also be good to add tests for this behaviour to detect platform differences or keep us from accidentally changing anything here. Would you be interested in writing a pull request to add this yourself? The files to edit should be |
@addaleax I'm not quite sure how to properly test this behavior, as the behavior would likely change depending on which OS you're running the test on. If you have any suggestions, please let me know and I'd be happy to write the test as well. |
@oliversalzburg There’s https://github.com/nodejs/node/blob/master/doc/guides/writing_tests.md for generic “How to write a test” things, and you can check for |
@addaleax Ah, sounds good. Thanks for the help :) |
@addaleax Is there also a guide for building Node on Windows? Because I'm getting a bunch of linker errors when trying to |
I am afraid I can only ask @nodejs/platform-windows, but it might help if you have the errors somewhere in a gist or something |
Alright, I'll put the information into the PR. Thanks again |
For reference, guide for building on Windows: https://github.com/nodejs/node/blob/master/BUILDING.md#windows |
So does this mean that |
@nfischer This behavior is present in Node 4 (and probably earlier as well). We initially noticed this in 4 and assumed it would be something that had changed between 4 and 6. We then realized that it had nothing to do with the version, but with us moving the code from Windows to UNIX. Also note that this is not really a Node-specific thing. This is simply how Windows handles environment variables. |
I understand this is how Windows does env variables. I just wanted to verify that the NodeJS API for accessing those env variables is likewise case-insensitive (as opposed to not guaranteeing if the key is "PATH" or "Path" or "path"). Case insensitive is the only thing that makes sense to me, but it's nice to have the guarantee 😄 I would hate to rely on this being case-insensitive, only to have it crash on someone else's Windows setup because it was undefined behavior. It would also be nice to know if this is intended as a feature in NodeJS going forward (again, I would hate to rely on this if it's likely to be reversed in v7 or v8). |
@nfischer The code relies on the |
Environment variables should be treated case-insensitive on Windows platforms and case-sensitive on UNIX platforms. This commit ensures this behavior persists. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
On Windows OS, environment variables are case-insensitive and are treated likewise in NodeJS. This can be confusing and can lead to hard-to-debug problems when moving code from one environment to another. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
Environment variables should be treated case-insensitive on Windows platforms and case-sensitive on UNIX platforms. This commit ensures this behavior persists. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
Environment variables should be treated case-insensitive on Windows platforms and case-sensitive on UNIX platforms. This commit ensures this behavior persists. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
On Windows OS, environment variables are case-insensitive and are treated likewise in NodeJS. This can be confusing and can lead to hard-to-debug problems when moving code from one environment to another. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
Environment variables should be treated case-insensitive on Windows platforms and case-sensitive on UNIX platforms. This commit ensures this behavior persists. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
On Windows OS, environment variables are case-insensitive and are treated likewise in NodeJS. This can be confusing and can lead to hard-to-debug problems when moving code from one environment to another. Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> PR-URL: #9166 Fixes: #9157
On Windows OS, environment variables are case-insensitive.
I think it could be beneficial to make a note about this in the docs.
The text was updated successfully, but these errors were encountered: