-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
test: check zlib version for createDeflateRaw #13697
Conversation
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt
test/osx failure looks unrelatednot ok 168 async-hooks/test-callback-error
---
duration_ms: 60.87
severity: fail
stack: |-
timeout |
assert.throws(() => { | ||
zlib.createDeflateRaw({ windowBits: 8 }); | ||
}, /^Error: Init error$/); | ||
if (process.versions.zlib.match(/^\d+\.\d+\.[9]|\d{2,}$/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be good to include a link to the reasoning in zlib for this directly rather than having people blame
and dig the link from the PR - but I'm fine with other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, let me add a comment and see what you think. Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use test()
instead of match()
. And +1 to adding the comment.
assert.throws(() => { | ||
zlib.createDeflateRaw({ windowBits: 8 }); | ||
}, /^Error: Init error$/); | ||
if (process.versions.zlib.match(/^\d+\.\d+\.[9]|\d{2,}$/)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you use test()
instead of match()
. And +1 to adding the comment.
No problem, I'll change this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the comment is added.
// This check was introduced in vesion 1.2.9 and prior to that there was | ||
// no such rejection which is the reason for the version check below | ||
// (http://zlib.net/ChangeLog.txt). | ||
if (/^\d+\.\d+\.[9]|\d{2,}$/.test(process.versions.zlib)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this regexp correct? What about a theoretical zlib 1.3.0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could probably be made stricter, yes. I also don’t quit get the |\d{2,}$
part – are there missing parentheses? /^a|b$/
is grouped as /(^a)|(b$)/
, not /^(a|b)$/
, but you probably meant something like the latter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@richardlau You are right, I missed that :(
@addaleax @richardlau I think I went at this the wrong way trying to match allowed versions. I hope I've managed to simplify the expression by trying to detect an invalid version instead. Let me know what you think.
// This check was introduced in vesion 1.2.9 and prior to that there was | ||
// no such rejection which is the reason for the version check below | ||
// (http://zlib.net/ChangeLog.txt). | ||
if ((/^(?!1\.2\.[0-8]$)/.test(process.versions.zlib))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn’t this equivalent to (!/^1\.2\.[0-8]$/.test(process.versions.zlib))
? That would look a bit simpler to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was choosing between the both and had a trouble making up my mind. I'd be happy to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one nit.
zlib.createDeflateRaw({ windowBits: 8 }); | ||
}, /^Error: Init error$/); | ||
// invalid by zlib (http://zlib.net/manual.html#Advanced). | ||
// This check was introduced in vesion 1.2.9 and prior to that there was |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I'll fix this.
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt PR-URL: nodejs#13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
Landed in 5189857 |
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt PR-URL: #13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt PR-URL: #13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
should this be backported to v6.x? |
I don't think this needs to be backported. Sorry again about the late/missed reply on this. |
BTW here at Yahoo we just backported this to our internal v6.x branch, since we |
@drewfish would you be willing to submit your patch as a backport to v6.x-staging? There are a ton of conflicts rn, but I'm sure we would be willing to land it so you don't need to float it. Also fwiw... if you are floating any other patches on 6.x please feel free to open an issue on https://github.com/nodejs/lts for us to take a look |
ping @drewfish |
pong #15478 |
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt Backport-PR-URL: #15478 PR-URL: #13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
We are currenly builing Node with --shared-zlib which happens to be version 1.2.8. The test for zlib.createDeflateRaw is expected to fail but does not when using version 1.2.8. As far as I can tell the fix referred to in the comments was introduced in version 1.2.9: - Reject a window size of 256 bytes if not using the zlib wrapper This commit suggests adding a check for the version and skipping this assert if the version is less than 1.2.9. Refs: http://zlib.net/ChangeLog.txt Backport-PR-URL: #15478 PR-URL: #13697 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Richard Lau <[email protected]>
We are currenly builing Node with
--shared-zlib
which happens to beversion
1.2.8
. The test for zlib.createDeflateRaw is expected to failbut does not when using version
1.2.8
.As far as I can tell the fix referred to in the comments was
introduced in version
1.2.9
:This commit suggests adding a check for the version and skipping this
assert if the version is less than
1.2.9
.Refs: http://zlib.net/ChangeLog.txt
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
test