Skip to content

Check every NIfTI symbol for the minc_ prefix, in both archives - #155

Open
gdevenyi wants to merge 1 commit into
BIC-MNI:develop-1.9.18from
gdevenyi:nifti-mangle-test
Open

gdevenyi wants to merge 1 commit into
BIC-MNI:develop-1.9.18from
gdevenyi:nifti-mangle-test

Conversation

@gdevenyi

Copy link
Copy Markdown
Contributor

Why

BIC-MNI/minc-toolkit-v2#246. testdir/check_nifti_mangled.cmake checks only nifti_image_read. The minc-toolkit superbuild builds the ITK nifti_clib fork (f24a607) with this repository's nifti_mangle.h, which was written for v3.0.0. Three symbols that the fork added have no minc_ prefix, and a develop-1.9.18 toolkit build exports them from libminc2.so:

nifti_image_write_bricks_status
nifti_image_write_status
nifti_set_fix_floats

This is the collision that the rename must prevent, and the test did not find it.

What

  • The test fails on each defined global symbol without the minc_ prefix.
  • It runs on libznz.a as well as libniftiio.a (new test znz_mangle_symbols).
  • It fails an archive that has no NIfTI code, for example a slim-LTO object with its IR stripped.

Verification

  • This branch (standalone, nifti_clib v3.0.0): all 102 symbols of libniftiio.a and all 8 of libznz.a pass. ctest passes 60/60.
  • Against a develop-1.9.18 toolkit install, the script names exactly the three symbols above.
  • It fails an archive that defines nifti_foo, and an archive that has no code.
  • No list(TRANSFORM), which needs CMake 3.12. libminc requires 3.10.

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01RCrjXCD1KiTWLtah7wmySX

check_nifti_mangled.cmake only looked for nifti_image_read. The
minc-toolkit superbuild builds the ITK nifti_clib fork (f24a607) with this
repository's nifti_mangle.h, which was written for v3.0.0. Three exports
the fork added -- nifti_image_write_status, nifti_image_write_bricks_status
and nifti_set_fix_floats -- are left unprefixed, and a develop-1.9.18
toolkit build exports them so from libminc2.so. That is the collision the
rename exists to prevent, and this test did not see it.

The test now fails on any defined global symbol without the minc_ prefix,
and runs on libznz.a as well as libniftiio.a. The positive check becomes
"the archive defines at least one symbol", so it applies to both archives
and still catches an archive with no NIfTI code in it (a slim-LTO object
with its IR stripped is one).

Verified: on this branch (standalone, nifti_clib v3.0.0) all 102 symbols of
libniftiio.a and all 8 of libznz.a pass, and ctest passes 60/60. Against
a develop-1.9.18 toolkit install the script names exactly the three
symbols above. It fails an archive that defines nifti_foo, and one that
holds no code. No list(TRANSFORM), which needs CMake 3.12; libminc
requires 3.10.

Fixes BIC-MNI/minc-toolkit-v2#246, together with the nifti_mangle.h update
in the nifti_clib pin bump.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RCrjXCD1KiTWLtah7wmySX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant