Skip to content

publish: fix duplicated skel/AppStream files and missing by-hash entries - #1620

Closed
KereMath wants to merge 5 commits into
aptly-dev:masterfrom
KereMath:fix/skel-appstream-publish
Closed

publish: fix duplicated skel/AppStream files and missing by-hash entries#1620
KereMath wants to merge 5 commits into
aptly-dev:masterfrom
KereMath:fix/skel-appstream-publish

Conversation

@KereMath

@KereMath KereMath commented Aug 20, 2026

Copy link
Copy Markdown

Description of the Change

Two bugs in publishing skeleton and AppStream (DEP-11) files:

  1. The skel and AppStream loops sat inside the per-component loop while iterating over
    all components themselves, so every file was written once per component. Publishing
    main + contrib appended each payload twice. Release checksums are computed
    afterwards, so the duplicated content is signed and apt accepts it silently.

  2. SkelIndex was the only index constructor not propagating acquireByHash, so with
    -acquire-by-hash the Release file advertises Acquire-By-Hash: yes while no
    by-hash/ entries exist for these files and apt gets a 404.

Checklist

  • allow Maintainers to edit PR (rebase, run coverage, help with tests, ...)
  • unit-test added (deb/publish_test.go)
  • functional test added (PublishRepo40Test)
  • author name in AUTHORS

The skeleton and AppStream loops were nested inside the per-component
loop while iterating over all components themselves, so every file was
written once per component. Publishing main + contrib appended each
payload twice. Release checksums are computed after the fact, so the
duplicated content is signed and apt accepts it silently.
SkelIndex was the only index constructor not propagating acquireByHash,
so with -acquire-by-hash the Release file advertises Acquire-By-Hash: yes
while no by-hash/ entries exist for these files and apt gets a 404.
Publishing two components appended each skeleton payload twice; the
existing skel test only publishes a single component so it did not
catch it.
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.17%. Comparing base (f59b0d2) to head (54a519b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1620      +/-   ##
==========================================
- Coverage   77.37%   77.17%   -0.21%     
==========================================
  Files         165      165              
  Lines       15747    15749       +2     
==========================================
- Hits        12185    12155      -30     
- Misses       2356     2399      +43     
+ Partials     1206     1195      -11     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Publish moved the skel and AppStream emission out of the per-component
loop, and codecov flags the relocated error branches as uncovered. Cover
them with deterministic failures:

- a regular file in the middle of the skel path makes the walk fail
  with ENOTDIR, which is not swallowed as a not-exist error
- nested skel/AppStream names each within NAME_MAX flatten into a
  temporary index file name that exceeds it, failing index creation
- an unreadable skel file (mode 0) fails the open (non-root only)
- a ~1MB filesystem as TMPDIR runs out of space mid-write, reusing the
  /smallfs convention from DiskFullSuite

Also add a unit-level happy path test publishing nested skel files and
checking they land in the published tree and the Release checksums.
@KereMath
KereMath force-pushed the fix/skel-appstream-publish branch from 4c51e7d to c54d44e Compare August 20, 2026 08:04
Regression test for the duplicated skel payload: publishing two
components used to append each skeleton file once per component. Fails
against the previous code with doubled file contents, mirroring the
PublishRepo40Test system test at unit level.
@KereMath KereMath closed this Aug 20, 2026
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