| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Thanks for working on this! I left some comments.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with a nit
Sorry, something went wrong.
Sorry, something went wrong.
|
Thank you @addaleax and @joyeecheung for the review comments. i'll continue to work on these review and will push changes soon. |
Sorry, something went wrong.
|
@addaleax could you elaborate a little more about the comment you and Joyee Cheung are discussing about changing return type to MaybeLocal? |
Sorry, something went wrong.
|
@devasci I don’t think it’s strictly blocking, because nothing crashes and it’s unlikely that we actually run into errors. In this PR, you’re adding new error conditions depending on the return code we get from libuv. There are multiple ways we could deal with that, e.g. returning undefined from the getter (which this PR currently ends up doing, but in a somewhat unusual way), returning an empty string from the getter (which would be String::Empty() rather than Local<String>()), or throwing an exception. When we throw an exception from a C++ function that is not directly exposed to JS, like RealEnvStore::Get(), the usual way to do that is to make the function return a MaybeLocal<> instead of a Local<>, and in the case of an error, throw an exception and return an empty handle (i.e. MaybeLocal<String>()) . Then, in the calling function (here that’s EnvGetter()), we check whether the return value is an empty MaybeLocal<>(), and if it is, we return to JS as quickly as possible to make the exception visible. The typical way to throw an exception for a libuv error is to use env->ThrowUVException(libuv_error_ode, "function_name");, e.g. in this case env->ThrowUVException(ret, "getenv");. env is the current Environment* instance; you can get it through env = Environment::GetCurrent(isolate); in this case (or update the KVStore functions to take an Environment* instead of an Isolate* pointer in order to have the Environment* instance available – that might make sense anyway). @joyeecheung If I have forgotten something, feel free to add that :) |
Sorry, something went wrong.
|
@addaleax thank you for writing very clearly, that helped me a lot to understand node code better. I've been working on the review comments you provided, most of them are fixed now. But i'm stuck with some error popping up while running make lint and make test. I tried to see possible causes of the error but i'm unable to fix that. Please help me out here. I get the below error, please assist me what could have been wrong: |
Sorry, something went wrong.
|
got the issue and fixed it, tests are passing now. |
Sorry, something went wrong.
There was a problem hiding this comment.
Awesome, this looks perfect!
Sorry, something went wrong.
Sorry, something went wrong.
|
😳 all tests are failing, looks like out/doc/applinks.json Error is back. If we do not throw UVException from RealEnv::Get method tests are passing. Should we dont throw any exception from RealEnv::Get method? |
Sorry, something went wrong.
|
@devasci The error is not related to doc tools, it indicates that the binary crashes on start up (which means there's a bug in the Get imeplementation - process.env getter is used a lot during bootstrap). |
Sorry, something went wrong.
There was a problem hiding this comment.
I think the bug may be in SafeGetenv() because that's not really handling the returned maybe correctly?
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
|
I’ve rebased this and kicked off a new CI. That should only fail on Windows and work once we have libuv/libuv#2419 in Node.js. |
Sorry, something went wrong.
|
This is going to be unblocked when #29508 lands. |
Sorry, something went wrong.
Sorry, something went wrong.
Sorry, something went wrong.
Modified RealEnvStore::Get, Set, Query and Delete methods to use libuv methods environment variables operations instead of using os specific logic and switches. Fixes: #27211 Refs: http://docs.libuv.org/en/v1.x/misc.html PR-URL: #27310 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sorry, something went wrong.
Modified RealEnvStore::Get, Set, Query and Delete methods to use libuv methods environment variables operations instead of using os specific logic and switches. Fixes: #27211 Refs: http://docs.libuv.org/en/v1.x/misc.html PR-URL: #27310 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Modified RealEnvStore::Get, Set, Query and Delete methods to use libuv methods environment variables operations instead of using os specific logic and switches. Fixes: #27211 Refs: http://docs.libuv.org/en/v1.x/misc.html PR-URL: #27310 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Setting an environment variable with an empty name on Windows resulted in an assertion failure, because it was checked for an '=' sign at the beginning without verifying the length was greater than 0. Fixes: #32920 Refs: #27310 PR-URL: #32921 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
| Back | FazBrowse Home | New Git URL |
Refactored RealEnvStore::Get, Set, Query and Delete methods to use uv_os_getenv/setenv/unsetenv methods to avoid conditional OS switches.
Checklist