-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
zlib different on OSX and Linux in newest releases #12244
Comments
cc/ @sam-github |
This seems to only be compression, not decompression. zlib.gunzip(compressed, function(err, buffer) {
if (buffer.toString('hex') === uncompressed.toString('hex')) {
console.log("Decompression results are the same");
} else {
console.log("Decompression results are different");
}
});
Does zlib/gzip make any guarantees about always producing the same compressed output? It shouldn't be required as long as the compressed results can be decompressed by a compatible implementation to produce the same input. |
I think this may be an upstream change. In the new version of zlib, if Commented: https://github.com/nodejs/node/pull/10980/files#r110047791 That's my current theory, at least. |
/cc @nodejs/lts |
The change of |
@MylesBorins I'm not sure it would be worth the effort to float a patch for this on an lts branch. @flippmoke is this causing an actual problem? Or is it just a change in behaviour that wasn't expected? |
@rmg It is not an actual issue with out code base, we were just using node.js zlib to compare against our C++ implementation inside a node application (https://github.com/mapnik/node-mapnik) for regular testing. We have been building off the system zlib We could change our testing techniques and perhaps and ignore the header of the gzip compressed binary when we compare the results. |
Or perhaps don't compare the zipped data, but unzip it and compare that to an expected value? That would be robust against implementation. |
@sam-github we could definitely do that, but part of the testing was to compare that all of our options that could be passed in for different configurations of zlib were all going in and creating reasonable results as well, so it really is nice to compare directly to another compressed result. I think if I can properly determine where the header of the zlib compression ends that I should be able to only test against the results after that point and achieve the same results. |
The problem is that gzip headers include a platform identifier. Previously, zlib was incorrectly treating macOS as just a "generic UNIX", but now it is actually using the correct header. The updated zlib made its way in to recent versions of node and started uncovering a new source of platform-specific assumptions that people didn't know they were making. To fix this, instead of hard-coding the expected gzip compression result, we can just generate them on the testing platform. This is an instance of nodejs/node#12244.
The problem is that gzip headers include a platform identifier. Previously, zlib was incorrectly treating macOS as just a "generic UNIX", but now it is actually using the correct header. The updated zlib made its way in to recent versions of node and started uncovering a new source of platform-specific assumptions that people didn't know they were making. To fix this, instead of hard-coding the expected gzip compression result, we can just generate them on the testing platform. This is an instance of nodejs/node#12244. Signed-off-by: Ryan Graham <[email protected]>
I just saw another instance of this causing an inexplicable test failure and the only reason I knew the cause was because I had dug in to this issue, and even that was only possible because @flippmoke had already done the hard work of identifying that it was a gzip header change. Spelling it out, I now realize how unreasonable it would be to expect the average node user to figure out what happened. @nodejs/lts I take back my previous stance. This part of the zlib upgrade should be reverted as part of an LTS patch release. |
@rmg could you please send a PR with the revert to both 4.x and 6.x? |
@MylesBorins I am looking at this now. I'll PR a test and revert of the header change. |
The problem is that gzip headers include a platform identifier. Previously, zlib was incorrectly treating macOS as just a "generic UNIX", but now it is actually using the correct header. The updated zlib made its way in to recent versions of node and started uncovering a new source of platform-specific assumptions that people didn't know they were making. To fix this, instead of hard-coding the expected gzip compression result, we can just generate them on the testing platform. This is an instance of nodejs/node#12244. Signed-off-by: Ryan Graham <[email protected]>
Given that #12404 was closed without merging, should this remain open? I strongly suspect 4.x is going to go EOL before this is fixed, but someone is welcome to prove me wrong by fixing it. :-D |
should close, the PR was rejected. |
It appears that after #10980, there are some issues with zlib specifically producing different results on OSX during gzip compression. This can be reproduced by the small test below, where there is a single byte difference in the zlib results. This same test does not produce different then expected results on Linux.
v4.8.1
OS-X
Results are the same
v4.8.1
Linux
Results are the same
v4.8.2
OS-X
Results are different
v4.8.2
Linux
Results are the same
I believe this also affects the v6 latest release, but have not tested it yet.
The text was updated successfully, but these errors were encountered: