Skip to content

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

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

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

Conversation

@KereMath

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.
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.
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.
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