| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
LGTM, but should the test be in a separate commit? |
Sorry, something went wrong.
I'm really not sure, I can check previous commits. To me it makes sense to include the test with the commit removing the regression. |
Sorry, something went wrong.
There was a problem hiding this comment.
Wouldn't it be better, if we just throw an isFinite check here?
Sorry, something went wrong.
There was a problem hiding this comment.
that is actually a great idea.
Sorry, something went wrong.
Sadly, it is as per the spec only. String.prototype.split says,
and 9.6 ToUint32: (Unsigned 32 Bit Integer) says,
|
Sorry, something went wrong.
|
@thefourtheye great idea, I've restructured this commit @evanlucas I'll need another LGTM. Rather than reverting I've added an extra check for infinity. It now makes much more sense to include the test |
Sorry, something went wrong.
|
@nodejs/testing is there a preference to writing more smaller tests, or putting this in with another test already testing querystring? |
Sorry, something went wrong.
|
Yea, I like this. LGTM. Definitely need CI on this one though to make sure arm is happy with it too |
Sorry, something went wrong.
|
Adding a new test is fine in this case, and it would be better to have this issue also mentioned somewhere in the comments. |
Sorry, something went wrong.
There was a problem hiding this comment.
Didn't our linter complain about unused variable? I thought this,
## disallow declaration of variables that are not used in the code
no-unused-vars: [2, {"args": "none"}]
forbids us
Sorry, something went wrong.
There was a problem hiding this comment.
yeah... I just pushed an update that fixes the linting issues
Sorry, something went wrong.
There was a problem hiding this comment.
expe4cted -> expected
Sorry, something went wrong.
There was a problem hiding this comment.
Now that we are doing it, let's introduce tests with NaN, 'Infinity' and 'NaN'
Sorry, something went wrong.
There was a problem hiding this comment.
@thefourtheye I've updated the test to include tests for all four "non finite" values
Sorry, something went wrong.
Sorry, something went wrong.
|
I couldn't think of any other corner cases. LGTM. |
Sorry, something went wrong.
|
It might be a little more efficient to add the isFinite() check to the line if (options && typeof options.maxKeys === 'number') {. Then you would only get the overhead if a number is provided as input. |
Sorry, something went wrong.
|
LGTM with a comment. |
Sorry, something went wrong.
|
In that case we can simply do if (options && Number.isFinite(options.maxKeys) |
Sorry, something went wrong.
Speaking for myself only, I definitely prefer smaller, isolated tests. |
Sorry, something went wrong.
There was a problem hiding this comment.
put in a full github url including hash for the exact version you're pulling from
Sorry, something went wrong.
|
/cc @manvalls @thealphanerd I think this is ok, lgtm
One thing to keep in mind is that separate tests take longer to run in CI than compacting them into fewer tests. Primarily due to very slow startup time on slower ARM machines but also it seems like this AIX and musl libc based systems have slow exit times (ref #5056). More files, separate tests is certainly the nicer way to approach it but I just wanted to register the above concern so that @nodejs/testing is aware of this and can (maybe) take it into account when forming opinions on how to best structure tests. |
Sorry, something went wrong.
|
@cjihrig @thefourtheye if we made the suggested change then maxKeys will always = 1000, this would also result in a behaviour change |
Sorry, something went wrong.
|
@rvagg I've updated the test with a comment that includes the github link, with sha and line numbers. As you can expect this link is far over the max characters per line. I've split it on to two lines, hopefully that isn't confusing |
Sorry, something went wrong.
|
@thealphanerd no, this is what I was proposing. It should be functionally equivalent to what you have, but slightly more efficient. And, as @thefourtheye pointed out, the last two conditions can be condensed to Number.isFinite(). var maxKeys = 1000;
if (options && typeof options.maxKeys === 'number' && isFinite(options.maxKeys)) {
maxKeys = options.maxKeys;
}
// maxKeys <= 0 means that we should not limit keys count
if (maxKeys > 0) { |
Sorry, something went wrong.
|
maxKeys is set just above though. Meaning that if(maxKeys > 0) will be true if options.MaxKeys === Infinity thus the split will be called with maxKeys set to 1000 which is still a behavior change. To double check that I am correct I have implemented your change and run it against the tests and we get a failure AssertionError: 1000 == 10000 |
Sorry, something went wrong.
|
Sorry, you're right. I was thinking we wanted maxKeys to be the default value on bad input. The existing behavior seems silly... Use 1000 as a default, but if a number is provided use that, but if it's not positive and finite, ignore it completely. |
Sorry, something went wrong.
Ya, that doesn't look right. Can we fix this behavior here? |
Sorry, something went wrong.
|
@thefourtheye I think we can fix that behavior, but that would be a Major change. In the mean time we do need to patch back the behavior that is expected (imho). Or are you arguing that the behavior itself was a bug? |
Sorry, something went wrong.
|
@thealphanerd Though it seems odd, as you pointed out, our priority here is to get this fixed asap, with the current functionality. Perhaps we can improve this in a separate patch. LGTM. |
Sorry, something went wrong.
|
I think it is also worth mentioning that #5012 rewrite all the code this is touching. |
Sorry, something went wrong.
Technically, exit itself is quick. What happens is that the parent exits without reaping the child processes, so init (pid 1) has to reap those zombies. The slow timeout on Alpine Linux was due to busybox init has a "design flaw" that will intentionally delay the reaping of the orphaned child processes. This has actually nothing to do with musl libc and I am pretty sure that busybox init with glibc has the exact same issue. Most likely this is what AIX init does too. Exit times are fast. But someone/something needs to reap the dead processes. Ideally should the parent process take care of that instead of letting init (pid 1) do it. |
Sorry, something went wrong.
|
Rubber-stamp LGTM |
Sorry, something went wrong.
There was a very subtle change in behavior introduced with 27def4f In the past if querystring.parse was given Infinity for maxKeys, everything worked as expected. Check to see is maxKeys is Infinity before forwarding the value to String.prototype.split which causes this regression PR-URL: nodejs#5066 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
|
Express must be happy now, right? |
Sorry, something went wrong.
|
Thanks @ncopa, that's very interesting background |
Sorry, something went wrong.
There was a very subtle change in behavior introduced with 27def4f In the past if querystring.parse was given Infinity for maxKeys, everything worked as expected. Check to see is maxKeys is Infinity before forwarding the value to String.prototype.split which causes this regression PR-URL: #5066 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
There was a very subtle change in behavior introduced with 27def4f In the past if querystring.parse was given Infinity for maxKeys, everything worked as expected. Check to see is maxKeys is Infinity before forwarding the value to String.prototype.split which causes this regression PR-URL: #5066 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
There was a very subtle change in behavior introduced with 27def4f In the past if querystring.parse was given Infinity for maxKeys, everything worked as expected. Check to see is maxKeys is Infinity before forwarding the value to String.prototype.split which causes this regression PR-URL: nodejs#5066 Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
| Back | FazBrowse Home | New Git URL |
There was a very subtle change in behavior introduced with 27def4f
In the past if querystring.parse was given Infinity for maxKeys,
everything worked as expected.
Check to see is maxKeys is Infinity before forwarding the value to
String.prototype.split which causes this regression