Skip to content

rubygem-pdf-reader: strip 47 PDF test fixtures from spec/data/#17342

Open
PawelWMS wants to merge 1 commit into
4.0from
pawelwi/rubygem-pdf-reader-strip-fixtures
Open

rubygem-pdf-reader: strip 47 PDF test fixtures from spec/data/#17342
PawelWMS wants to merge 1 commit into
4.0from
pawelwi/rubygem-pdf-reader-strip-fixtures

Conversation

@PawelWMS
Copy link
Copy Markdown
Contributor

@PawelWMS PawelWMS commented May 18, 2026

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 — %files excludes spec/ entirely; the fixtures exist only during %check's rspec run.

How

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. So %check continues running — the 47 affected context blocks in spec/integration_spec.rb get gracefully marked pending, and the remaining ~60 PDFs in spec/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.toml glob).
  • 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 in pkgs_modified/rubygem-pdf-reader/ (SHA-512 49de5d0e…51fd708).
  • base/comps/rubygem-pdf-reader/modify_source.sh — the deterministic repack + helper-patch script.
  • 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 updated.

Build impact

%check continues to run. 47 contexts in spec/integration_spec.rb become rspec "pending" instead of erroring out; the rest of the suite exercises its code paths unchanged.

@PawelWMS PawelWMS force-pushed the pawelwi/rubygem-pdf-reader-strip-fixtures branch 2 times, most recently from ad05a51 to f241eff Compare May 18, 2026 23:40
@PawelWMS PawelWMS changed the title rubygem-pdf-reader: strip 23 scanner-flagged PDF fixtures from Source1 rubygem-pdf-reader: expand fixture strip list from 23 to 47 PDFs May 19, 2026
@PawelWMS PawelWMS force-pushed the pawelwi/rubygem-pdf-reader-strip-fixtures branch 2 times, most recently from 045d833 to 03bc9f7 Compare May 19, 2026 16:59
@PawelWMS PawelWMS changed the title rubygem-pdf-reader: expand fixture strip list from 23 to 47 PDFs rubygem-pdf-reader: strip 47 PDF test fixtures from spec/data/ May 19, 2026
@PawelWMS PawelWMS marked this pull request as ready for review May 19, 2026 17:37
Copilot AI review requested due to automatic review settings May 19, 2026 17:37
@PawelWMS PawelWMS requested a review from christopherco as a code owner May 19, 2026 17:37
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.toml that replaces the upstream Source1 tarball with a modified lookaside artifact (with replace-upstream = true + rationale).
  • Add modify_source.sh to deterministically repack Source1 and patch spec/support/reader_spec_helper.rb to mark the affected tests as skipped/pending instead of failing.
  • Refresh the lock + re-rendered spec artifacts (Release bump and updated Source1 SHA-512), and remove the inline component entry from components.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_REMOVE is 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.

Comment thread base/comps/rubygem-pdf-reader/modify_source.sh Outdated
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).
@PawelWMS PawelWMS force-pushed the pawelwi/rubygem-pdf-reader-strip-fixtures branch from 03bc9f7 to e60f8e5 Compare May 19, 2026 17:55
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.

2 participants