fix(rubygem-pdf-reader): strip 47 PDF test fixtures#17342
Conversation
ad05a51 to
f241eff
Compare
045d833 to
03bc9f7
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the rubygem-pdf-reader component to avoid SRPM scanning failures by replacing the upstream pdf-reader-2.4.2-spec.txz (Source1) with a locally-modified tarball that removes 47 pathological PDF fixtures from spec/data/, while keeping %check running by patching the rspec helper to skip only the removed fixtures.
Changes:
- Add a dedicated
rubygem-pdf-reader.comp.tomlthat replaces the upstream Source1 tarball with a modified lookaside artifact (withreplace-upstream = true+ rationale). - Add
modify_source.shto deterministically repack Source1 and patchspec/support/reader_spec_helper.rbto mark the affected tests as skipped/pending instead of failing. - Refresh the lock + re-rendered spec artifacts (
Releasebump and updated Source1 SHA-512), and remove the inline component entry fromcomponents.toml.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
base/comps/components.toml |
Removes the inline rubygem-pdf-reader entry now that customization lives in a dedicated .comp.toml. |
base/comps/rubygem-pdf-reader/rubygem-pdf-reader.comp.toml |
Replaces upstream Source1 with a locally-modified pdf-reader-2.4.2-spec.txz in pkgs_modified/, including a replacement rationale. |
base/comps/rubygem-pdf-reader/modify_source.sh |
Adds a deterministic repack + helper patch workflow to strip fixtures and keep %check functioning. |
locks/rubygem-pdf-reader.lock |
Updates the input fingerprint to reflect the component definition change. |
specs/r/rubygem-pdf-reader/rubygem-pdf-reader.spec |
Rendered spec update (release bump) corresponding to the component change. |
specs/r/rubygem-pdf-reader/sources |
Updates the SHA-512 for the replaced Source1 tarball. |
Comments suppressed due to low confidence (1)
base/comps/rubygem-pdf-reader/modify_source.sh:131
- This log line / comment still references "23 stripped fixtures" but
FIXTURES_TO_REMOVEis documented as 47 entries and the rest of the script uses${#FIXTURES_TO_REMOVE[@]}. Consider updating these references to 47 (or make the message dynamic) so the script output and comments stay accurate if the list changes.
echo "[5/6] Patching ${HELPER_FILE} (skip only for the 23 stripped fixtures; still raise otherwise)"
helper="${EXTRACT_DIR}/${HELPER_FILE}"
if [[ ! -f "${helper}" ]]; then
echo "ERROR: helper missing from upstream tarball: ${HELPER_FILE}" >&2
exit 1
fi
# The original helper has a single `else / raise ArgumentError, ...` arm for
# the missing-fixture case. We surgically insert a new `elsif` arm BEFORE the
# existing `else`, gated by an explicit allow-list of the 23 stripped
# basenames (with `.pdf` extension). Any other missing fixture still raises,
# so an unrelated upstream change that drops a different fixture surfaces as
# a hard error rather than a silent skip.
03bc9f7 to
e60f8e5
Compare
reubeno
left a comment
There was a problem hiding this comment.
Left a comment. Could you please also update the commit and PR to use conventional commit syntax, as described in CONTRIBUTING.md, please?
| # Helper file whose missing-fixture branch is patched from | ||
| # `raise ArgumentError, ...` to `skip "..."` so rspec gracefully | ||
| # marks affected examples pending instead of failing them. | ||
| HELPER_FILE="spec/support/reader_spec_helper.rb" |
There was a problem hiding this comment.
Per our discussion, changes to this file should really be applied using a proper visible patch that's not buried in this removal script. I think we can take this change for now, but I'd like you to file a tracking bug on it for each such script that does this sort of thing.
Remove 47 pathological PDF test fixtures from the upstream
spec/data/ directory in Source1 (pdf-reader-2.4.2-spec.txz) to
avoid scan failures on the SRPM. All fixtures are benign upstream
regression PDFs (deliberately-malformed structures,
encrypted-cipher variants) that are not consumed at AZL runtime.
The companion helper-file patch in modify_source.sh makes
pdf_spec_file() in spec/support/reader_spec_helper.rb call rspec's
`skip` only for the 47 removed filenames; it still raises
`ArgumentError` for any other missing fixture. `%check` continues
to run and the remaining ~60 fixtures in spec/data/ still exercise
the regression suite.
Files:
- `base/comps/components.toml`: remove the inline
`[components.rubygem-pdf-reader]` row (the dedicated component
file is auto-included by the `**/*.comp.toml` glob).
- `base/comps/rubygem-pdf-reader/rubygem-pdf-reader.comp.toml`:
declare a `[[components.rubygem-pdf-reader.source-files]]`
block with `replace-upstream = true` pointing at the
locally-modified Source1 in `pkgs_modified/rubygem-pdf-reader/`
(SHA-512 `49de5d0e...51fd708`).
- `base/comps/rubygem-pdf-reader/modify_source.sh`: deterministic
script that downloads upstream Source1, verifies its published
SHA-512, extracts, deletes the 47 flagged PDFs, surgically
patches `spec/support/reader_spec_helper.rb` to inject an
`AZL_STRIPPED_FIXTURES` allow-list plus an `elsif` clause that
skips only matching basenames, and repacks via
`tar --sort=name --mtime --owner=0 --group=0 --numeric-owner |
xz -T1 -9e`. Single-threaded xz keeps the output hash host-CPU
independent.
- `locks/rubygem-pdf-reader.lock`: refreshed `input-fingerprint`
and `upstream-commit`.
- `specs/r/rubygem-pdf-reader/{rubygem-pdf-reader.spec,sources}`:
re-rendered (release bumped to 12, `sources` SHA-512 swapped to
the modified-tarball hash).
e60f8e5 to
8dcee7f
Compare
Koji build.
Summary
Remove 47 pathological PDF test fixtures from the upstream
spec/data/directory in Source1 (pdf-reader-2.4.2-spec.txz) to avoid scan failures on the SRPM. All fixtures are benign upstream regression PDFs (deliberately-malformed structures, encrypted-cipher variants) that are not consumed at AZL runtime —%filesexcludesspec/entirely; the fixtures exist only during%check'srspecrun.How
The companion helper-file patch in
modify_source.shmakespdf_spec_file()inspec/support/reader_spec_helper.rbcall rspec'sskiponly for the 47 removed filenames; it still raisesArgumentErrorfor any other missing fixture. So%checkcontinues running — the 47 affectedcontextblocks inspec/integration_spec.rbget gracefully marked pending, and the remaining ~60 PDFs inspec/data/continue to exercise the regression suite.The repack is byte-deterministic (
tar --sort=name --mtime --owner=0 --group=0 --numeric-owner | xz -T1 -9e) so the resulting SHA-512 is reproducible from a fresh clone.Files
base/comps/components.toml— remove the inline[components.rubygem-pdf-reader]row (dedicated component file is auto-included by the**/*.comp.tomlglob).base/comps/rubygem-pdf-reader/rubygem-pdf-reader.comp.toml— dedicated component file with a[[...source-files]]block (replace-upstream = true) pointing at the locally-modified Source1 inpkgs_modified/rubygem-pdf-reader/(SHA-51249de5d0e…51fd708).base/comps/rubygem-pdf-reader/modify_source.sh— the deterministic repack + helper-patch script.locks/rubygem-pdf-reader.lock— refreshedinput-fingerprintandupstream-commit.specs/r/rubygem-pdf-reader/{rubygem-pdf-reader.spec,sources}— re-rendered: release bumped to 12,sourcesSHA-512 updated.Build impact
%checkcontinues to run. 47 contexts inspec/integration_spec.rbbecome rspec "pending" instead of erroring out; the rest of the suite exercises its code paths unchanged.