Refuse to read package metadata as empty when it exists but cannot be opened - #323
Refuse to read package metadata as empty when it exists but cannot be opened#323ryanrhughes wants to merge 1 commit into
Conversation
…not be opened The version check runs as root; the build container runs as an unprivileged user. Forty-two .omarchy/package.json files on the release host were mode 0600, so root read release_ring=fast and queued dropbox-cli for rc and stable while the container, unable to open the same file, read no ring and skipped it. Each release ran with nothing to publish, auto-release counted that as success and cleared the queue, and the next version check wrote it straight back — 34 empty runs in two hours, one chat report per run. package_require_readable_metadata aborts with status 2 and a message naming the file whenever metadata exists but is unreadable, and every reader in package-metadata.sh goes through it. The package enumerators materialize package_dirs into a variable instead of piping it into a loop, so that abort reaches the caller rather than ending a subshell and leaving a silently shorter list. check-versions exits without touching the queue, and build.sh refuses to build a partial list, when enumeration fails. A self-test covers the unreadable case end to end.
|
Reviewed at head 4cee5d9. The diagnosis is right and the two call sites you fixed are fixed: Verified on a worker VM as uid 1000, so the guard is live, against a three-package tree with the middle package's
Two conditions the guard does not reach, both the same silently-wrong class the PR is about. A zero-byte or whitespace-only The new self-test does not run in CI. What I checked and found clean: all 131 package directories have a PKGBUILD and a readable 0644 Reviewed by Claude Opus 5 in Claude Code and independently by Codex at xhigh reasoning. Codex reached the same four consumer findings and the same severity ordering; its independence is not currently guaranteed, so read that as agreement rather than confirmation. What it contributed that I had not reasoned about is the unreadable- Waiting on you for the four unfixed call sites. |
Follow-up to #320. rc and stable ran a release for
dropbox-clievery five minutes tonight, built nothing, and requeued it on the next tick: 34 "nothing to publish" reports in two hours.Cause
On the release host, 42
pkgbuilds/*/.omarchy/package.jsonfiles were mode0600 root:root(all dated Aug 13; git tracks them as100644, a fresh clone gets0644, so this was local damage on the host). The two halves of the pipeline read that file as different users:release_ringseenfastpackage_metadata_valuesaw the file exist,jqfailed to open it, and the function returned its default. Nothing distinguished "unreadable" from "no ring". The release finished with nothing to publish,auto-releasetreated that as success and cleared the queue, and the next version check refilled it. 11 of the 42 files belonged to fast-ring packages, so the same loop would recur for any of them once edge moved ahead.The host is repaired (
chmod 644; both channels published dropbox-cli 2.1 on the next tick). This PR stops the tooling from ever hiding that class of failure again.Changes
package_require_readable_metadatainhelpers/package-metadata.sh: metadata that exists but cannot be read aborts with status 2 and a message naming the file and the fix. Every reader in the helper goes through it, includingpackage_is_fast_ringat the call site, since its ring lookup runs inside a command substitution where an abort would only end the subshell.packages_for_unscoped_build,packages_for_mirror,packages_for_aur_sync,packages_for_upstream_sync,packages_for_rebuild_sync) andpackage_dirsmaterialize their input into a variable instead ofproducer | while, so the abort propagates instead of yielding a silently shorter list.check-versionsexits without touching any queue when enumeration fails;build/build.shrefuses to build a partial list. Both print the file that could not be read.sync-rebuilds --self-testcovers the unreadable case: ring lookup, mirror decision, and enumeration all abort with status 2, the message names the file, and a readable file reads normally again. It skips itself when run as root, where every file is readable.Verification
check-versionsagainst today's edge database: readable metadata behaves as before; a0000dropbox-climetadata file aborts with the message and writes no queue files.build/build.sh --dry-runfor rc: the unreadable file aborts with "refusing to build a partial list"; readable proceeds todropbox-cli.