Skip to content

fix(release): anchor RPM package paths before extraction cd - #28

Merged
AlexMikhalev merged 1 commit into
mainfrom
fix/v1.21.16-relative-pkg-path
Sep 25, 2026
Merged

AlexMikhalev merged 1 commit into
mainfrom
fix/v1.21.16-relative-pkg-path

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Summary

Seal run 36171579110 failed in the "Build managed DEB/RPM packages" step on both
musl lanes with:

rpm2cpio: client-managed-packages/.terraphim-client-nfpm.C4845S/packages/terraphim-agent-1.21.16-1.x86_64.rpm: No such file or directory
cpio: premature end of archive

nFPM created the RPM seconds earlier, so the file existed. The workflow invokes
the producer with a relative --out-dir client-managed-packages/${TARGET};
verify_rpm then extracted the payload with (cd "$tmp" && rpm2cpio "$pkg" ...),
so the relative package path resolved against $tmp and reported the freshly
built package as missing.

This build step never ran before: run 1 (36164026957) died at the lifecycle gate
(old rpm2cpio hard-fail, fixed in #27), which left the build step SKIPPED. Run 2's
gate passed, exposing the latent path bug.

Changes

  • build-client-packages.sh verify_rpm(): anchor the package path with
    realpath before any cd, exactly as docker_rpm_tool already does.
  • test_client_nfpm_native.sh inspect_rpm(): same defensive anchor after
    mkdir -p "$extract" (callers pass absolute paths today; this keeps that a
    guarantee rather than an accident).

Verification

  • /tmp/relprod-driver.sh runs the real producer end-to-end with the exact CI
    invocation shape (relative --out-dir client-managed-packages/x86_64-unknown-linux-musl,
    stripped cc -s ELF stand-ins, nfpm 2.47.0, SOURCE_DATE_EPOCH):
    • pre-fix script (stashed): reproduces the hosted failure byte-for-byte
      (exit 1, ENOENT on the rpm2cpio line).
    • fixed script: exit 0; both binaries' DEB+RPM verified via host rpm2cpio
      payload+SHA checks, docker lintian/rpmlint policies satisfied, 5 outputs
      published (2 deb, 2 rpm, package-sha256sums.txt).
  • bash -n clean on both scripts.
  • Full local suites still green (arch, policy, strip, inspect-rpm truncation
    fail-closed).
  • Swept every cd ... && across nfpm/release scripts: exactly these two
    hazardous sites; all other cds are root resolution or safe in-dir patterns.
  • test_client_nfpm_native_actual.sh audited (the next first-time runner):
    builds upgrade-transition packages into absolute $TMP/out-upgrade and
    installs from the original cwd; no cd hazard with the relative PACKAGE_DIR.

Refs #337

Seal run 36171579110: the managed-package lifecycle gates passed (the
previous rpm2cpio payload-judgement fix worked), which let the
"Build managed DEB/RPM packages" step run for the first time - and it
failed with "RPM payload extraction produced no terraphim-agent"
seconds after nFPM created the file. Root cause: verify_rpm's host
branch extracts with `cd "$tmp" && rpm2cpio "$pkg"`, and the workflow
invokes the producer with a relative --out-dir, so the relative
package path resolved inside $tmp and rpm2cpio reported the package
as missing. docker_rpm_tool already anchored its path with realpath;
the host branch now does the same, and inspect_rpm in the native gate
anchors its package path for the same guarantee.

Verified locally against the exact production invocation shape
(producer + relative --out-dir): pre-fix reproduces the hosted ENOENT
failure byte-for-byte; post-fix the producer passes end-to-end (DEB
and RPM for both binaries, host rpm2cpio extraction, docker
lintian/rpmlint policies, inventory assembly, atomic publish rename).
Wrong-arch, REQUIRE_INSTALL policy, canonical-input strip, and
inspect_rpm repro suites all green.

Refs #337
@AlexMikhalev
AlexMikhalev merged commit 9ffa595 into main Sep 25, 2026
2 checks passed
@AlexMikhalev
AlexMikhalev deleted the fix/v1.21.16-relative-pkg-path branch September 25, 2026 19:01
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