Repository navigation
BUG: Compare NIfTI test output by content, not by compressed bytes - #96
Merged
Merged
Conversation
seanm
reviewed
Oct 5, 2026
hjmjohnson
force-pushed
the
pr/test-gz-content-compare
branch
from
October 6, 2026 14:35
07c38b2 to
0f3a71d
Compare
hjmjohnson
force-pushed
the
pr/test-gz-content-compare
branch
2 times, most recently
from
November 2, 2026 20:37
56d537f to
05b9f9d
Compare
nifti_c22_copy_image fails on systems whose zlib is zlib-ng 1.3.1. It
converts an image i16 -> i64 -> i16 and asserts the result matches the
original, using
cmp out.c22.0.i16.nii.gz out.c22.2.0.i16.nii.gz
That compares gzip output, which is not reproducible across zlib
implementations. zlib-ng, which Arch, CachyOS, and a growing number of
distributions ship in place of stock zlib, encodes the same input
differently. Both files come out at exactly 642454 bytes and differ from
byte 321594 on.
The conversion itself is fine. Decompressed, the two files are
byte-identical at 1114768 bytes each, so the round-trip through int64
and back preserves the data exactly, which is what the test set out to
check. Confirmed the other way too: in an Ubuntu 24.04 container with
stock zlib 1.3, the test passes unmodified.
The test now decompresses before comparing, via a small nii_cmp helper
that falls back to plain cmp for uncompressed files. The i16 -> f32 ->
i16 comparison now also fails the test on a mismatch; it only printed a
message before. With this the suite is 92 of 92 on both zlib-ng and
stock zlib; previously it was 91 of 92 on any zlib-ng system.
hjmjohnson
force-pushed
the
pr/test-gz-content-compare
branch
from
November 6, 2026 15:10
05b9f9d to
09adee5
Compare
Member
Author
|
@greptileai review |
seanm
approved these changes
Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
nifti_c22_copy_imagecompared gzip bytes, which differ between zlib and zlib-ng 1.3.1; it now compares decompressed content. The i16 -> f32 -> i16 comparison now fails the test on a mismatch instead of only printing a message.Re-submission of #31, reverted from
masteron 2026-09-24 so it can be reviewed before merging. Base:master. Independent: nothing has to land before it. Ordering for all the re-submitted work is tracked in #84.Changes since the original #31
nii_cmpremoves its temporary.rawfiles when decompression fails, too.Test evidence
out.c22.2.1.i16.nii.gzmakes the test fail ("decompressed content differs"). A truncated gzip file also fails it and leaves no.rawfiles behind.