Skip to content

Remove unused CFITSIO Fortran wrappers from wheels - #190

Merged
tpn merged 3 commits into
mainfrom
codex/cfitsio-wheel-notices-20261112
Nov 13, 2026
Merged

tpn merged 3 commits into
mainfrom
codex/cfitsio-wheel-notices-20261112

Conversation

@tpn

@tpn tpn commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

Linux wheels currently bundle unused CFITSIO Fortran wrappers and omit the notice for its retained Bison-generated parser. Build CFITSIO with --without-fortran, ship the parser's full notice and Bison exception, and include its license expression in native wheel metadata.

Distribution checks now reject Fortran wrapper exports and missing or altered notices. Source builds continue to use externally supplied CFITSIO.

Validation: 107 focused tests, repository hooks, and the built source archive's strict metadata/license checks pass. The edited recipe passes 54 upstream CFITSIO tests plus C API FITS round-trip, table-expression, and reentrant checks; all original non-Fortran exports are preserved. Full native wheel CI will qualify both architectures.

Build the bundled library with the C API only and preserve the retained
Bison parser notice and exception in distributions. Require the notice
and C-only exports when checking repaired wheels.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
@tpn
tpn requested a review from melo-gonzo as a code owner November 12, 2026 17:15
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds the CFITSIO Bison parser license to distribution notices and metadata. The wheel build disables Fortran wrappers. Distribution checks validate license contents and bundled CFITSIO symbols.

Changes: CFITSIO distribution and validation

Layer / File(s) Summary
License notices and packaging metadata
licenses/CFITSIO-4.7.0-Bison.txt, THIRD_PARTY_NOTICES.md, MANIFEST.in, packaging/conda/recipe.yaml, pyproject.toml, scripts/wheels/repair_wheel.py, scripts/wheels/check_distributions.py, tests/test_distribution_licenses.py
Adds the Bison parser license to notices and package metadata. The wheel license expression includes the Bison exception.
CFITSIO build and symbol validation
scripts/wheels/prepare_cfitsio.sh, scripts/wheels/check_distributions.py, tests/test_distribution_licenses.py
The wheel build disables Fortran wrappers. Wheel validation checks required CFITSIO symbols and rejects invalid ELF data and Fortran-wrapper symbols.
Archive license validation
scripts/wheels/check_distributions.py, tests/test_distribution_licenses.py
Wheel and source-archive checks verify license-file digests. Tests cover archive license files and truncated license content.
Merge Risk: Minimal · up to 1c114

The change builds the bundled CFITSIO without its unused Fortran wrappers, adds the parser's license notice, and tightens distribution checks. No actionable merge-blocking risk is evident. Native wheel CI on both architectures remains the normal final qualification.

Security architecture risk: Low · up to 1c114

The changes narrow the bundled library’s intended interface and strengthen distribution checks without adding application-facing entrypoints or privileges. No security regression was identified, but final native-wheel qualification on both architectures remains unverified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed executable dependency is delivered to users installing the Linux native wheels. Artifact-controlled bytes also reach the existing CI validation process, but the new checks do not introduce another service, tenant authority, credential source, or privileged runtime entrypoint.

Trust Boundaries and Controls

  • observed — The CFITSIO download remains bound to a fixed upstream commit and SHA-256 digest, with HTTPS-only retrieval and checksum verification before extraction and building. The PR does not relax those existing supply-chain controls.
  • observed — The new CFITSIO inspection passes a fixed argument vector to readelf and does not load the inspected library or interpolate its contents into a shell command. Existing CUDA-library checks already inspect archive-provided ELF bytes through the same external-tool boundary.

Resilience and Maintainability Implications

  • observed — Invalid symbols, ELF data, or license contents cause validation failure and a nonzero CLI exit. Existing workflows run this validation before uploading the aggregate distribution and again during release staging; publication requires successful staging. The PR therefore tightens the existing acceptance gate rather than adding a bypass around it.
Pre-merge checks: Passed 2

Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 83e204d and 1c114b3.

Files selected for processing: 1

  • tests/test_distribution_licenses.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@tpn tpn added the ai-review Request a focused CodeRabbit review label Nov 12, 2026

@melo-gonzo melo-gonzo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks right. I checked the parts that depend on upstream at the pinned CFITSIO commit:

  • --without-fortran is a real option there. It sets NOFORTRAN, which drops f77_wrap1.c to f77_wrap4.c from libcfitsio_la_SOURCES. Without the flag, configure adds the wrappers whenever it finds a Fortran compiler, so the flag makes the build independent of the image. The x86_64 wheel log shows cfitsio: Building without Fortran support.
  • The notice in licenses/CFITSIO-4.7.0-Bison.txt matches eval_y.c exactly, and the copyright, license and exception text also matches eval_tab.h. The GPL text matches gpl-3.0.txt from gnu.org.
  • check_distributions.py ran on all six wheels in CI and passed, so the new symbol check also passed on the real libraries.
  • tests/test_distribution_licenses.py passes 43 tests. Removing the wrapper check, the check_cfitsio_symbols call, the sdist license-file loop or the new expression term each fails at least one test.

Considerations, none blocking:

  • Two branches of check_cfitsio_symbols have no failing test: the required C API symbols (ffopen, ffclos, fits_is_reentrant) and the invalid-ELF exit. A cfitsio_elfs variant without fits_is_reentrant, plus non-ELF bytes, would cover both.
  • The wheel License-Expression now contains GPL-3.0-or-later WITH Bison-exception-2.2. That is the accurate SPDX form, but some license scanners flag GPL-3.0 without reading the WITH clause. It may be worth a heads-up to whoever reviews the release licenses.
  • The GPU installed-wheel job was still pending when I checked.
Checks at 2bb2715
CFITSIO d6d27653 configure.ac:
  AC_ARG_WITH([fortran], [AS_HELP_STRING([--without-fortran],[Build package without Fortran support])], ...
  AM_CONDITIONAL(NOFORTRAN, test x$use_fortran = xno)
CFITSIO d6d27653 Makefile.am:
  if !NOFORTRAN
  libcfitsio_la_SOURCES += $(F77_WRAPPERS)

notice block verbatim in eval_y.c: True
copyright..exception verbatim in eval_tab.h: True
GPL-3.0 text verbatim at end of license file: True

tests/test_distribution_licenses.py, unmodified      -> 43 passed
  wrapper check removed                              -> 1 failed, 42 passed
  check_cfitsio_symbols call removed                 -> 1 failed, 42 passed
  sdist license files not checked                    -> 3 failed, 40 passed
  Bison term dropped from wheel expression           -> 23 failed, 20 passed
  C API symbol requirement removed                   -> 43 passed
  readelf exit-code check removed                    -> 43 passed

tpn added 2 commits November 12, 2026 18:16
Exercise missing C API symbols and invalid ELF bytes so regressions in
these wheel validation safeguards are caught by the test suite.

Signed-off-by: Trent Nelson <trentn@nvidia.com>
@tpn

tpn commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator Author

@melo-gonzo Addressed the two test gaps from your review in 1c114b3.

The ELF fixture now includes a library missing fits_is_reentrant, and a second test supplies non-ELF bytes with the correct version marker so it reaches the ELF check. Both assert the specific error message.

All 45 distribution tests and repository hooks pass. I also verified that removing either safeguard makes its corresponding new test fail. Full CI, including native wheels and installed-wheel GPU tests, is now green at that commit. CodeRabbit's incremental review also completed with no actionable comments.

@tpn
tpn merged commit e2fe212 into main Nov 13, 2026
57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a focused CodeRabbit review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants