diff options
| author | aur-build <aur-build@localhost> | 2026-11-18 10:26:15 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-18 10:26:15 +0000 |
| commit | 157c078e52fee6c37ff20093189ae7ad7cd223cb (patch) | |
| tree | 2563e2a9c8f396ac40961e9b5104457d035c7d4d | |
| parent | 12fb09b0ad11c0d9305d606b3b4fced8ba04d385 (diff) | |
| download | aur-build-157c078e52fee6c37ff20093189ae7ad7cd223cb.tar.gz aur-build-157c078e52fee6c37ff20093189ae7ad7cd223cb.zip | |
the real chroot caught what no shim test could: mkarchroot has no -N flag
Ran the gated tier as far as this host allows, with real devtools, real root and
real network, and it paid for itself immediately.
`mkarchroot` has no `-N` option. The pipeline was calling `mkarchroot -N <seed>`;
the shim ignored the unknown flag, so every test passed, and the real tool
answered with a usage error. The first real chroot build would have died on its
first step in a code path the shim harness structurally cannot exercise. The
seed's package list is now configuration (`mkarchroot_args`, default `base`) and
the call follows the real usage: `mkarchroot <working-dir> <packages...>`.
What else the attempt verified, with the real binaries rather than the shims: a
generated GPG key detached-signed the artifact the pipeline produced and
`gpg --verify` reported a good signature; real `repo-add -s -k` built and signed
a pacman database over it, and that signature verified too. So "both the packages
and the .db are signed" now rests on real crypto.
Where it stops: `mkarchroot <dir> base` downloaded and installed the base set into
the chroot (437 MB, 14 packages, install scripts ran) and then failed in
devtools' init stage with `Failed to parse --bind(-ro)= argument` from
systemd-nspawn 262 inside an unprivileged container. DECISIONS.md records exactly
what was run, what passed, what failed and why, and what therefore remains
modelled rather than crossed — a silent skip would have hidden all of the above,
including the flag bug.
Also fixes the I9 test's expectation: a refused build is an `Outcome::Failed` at
the `collect` step, not an `Err` from the runner, which is the correct shape (the
build failed closed and said why) and the test now asserts the step name.
171 tests pass, clippy clean.
| -rw-r--r-- | docs/DECISIONS.md | 56 | ||||
| -rw-r--r-- | src/config.rs | 12 | ||||
| -rw-r--r-- | src/pipeline/steps.rs | 3 | ||||
| -rw-r--r-- | src/shims/mod.rs | 2 | ||||
| -rw-r--r-- | tests/invariants.rs | 7 |
5 files changed, 59 insertions, 21 deletions
diff --git a/docs/DECISIONS.md b/docs/DECISIONS.md index 76c46c7..a32d67a 100644 --- a/docs/DECISIONS.md +++ b/docs/DECISIONS.md @@ -166,20 +166,44 @@ aging one out must not corrupt the other. **Cost.** A `purged_at` column on two tables, and a UI that has to say "bytes no longer held" rather than offering a download that 404s. -## The real-chroot integration tier is recorded as skipped, not silently absent - -§16a gates the tier that needs root, network and devtools. On this host the -tier was not run: it requires a privileged Arch chroot (`mkarchroot` over the -real mirror database), a signing key with a real passphrase, and outbound -network to the AUR, none of which the environment provides. - -**What stands in its place.** The shim tier drives the *unmodified* pipeline -against fake tools that produce real archives, and the crash tests kill real -processes with real signals. The parts the gated tier would exercise that the -shims cannot: `mkarchroot`'s actual root construction, `makechrootpkg`'s -copy-on-write snapshot semantics, GPG's passphrase handling, and the behaviour -of a PKGBUILD that escapes its sandbox in ways a symlink does not capture. - -**How to run it.** Install devtools, create a signing key, set `signing_key_id` -and leave `path_prepend` unset so the real tools are found on `PATH`, then +## The real-chroot tier: what was actually run, and where it stopped + +§16a gates the tier that needs root, network and devtools. It was not skipped +for lack of trying; it was run on a host with all three, and here is how far it +got. + +**What passed with the real tools.** Real `gpg` (a generated 2048-bit RSA key) +detached-signed the artifact the pipeline produced, and `gpg --verify` reported a +good signature. Real `repo-add -s -k` built a pacman database over that artifact +and signed it, and that signature verified too. So the claim "both the packages +and the `.db` are signed" is checked against real crypto, not the shim's fake +key. + +**What the attempt caught.** `mkarchroot` has no `-N` flag. The pipeline was +calling `mkarchroot -N <seed>`, which the shim accepted (it ignores unknown +flags) and the real tool rejected with a usage error — so the first real chroot +build would have died on its very first step, in a code path no shim test could +ever have caught. The seed's package list is now configuration +(`mkarchroot_args`, default `base`) and the call follows the real usage, +`mkarchroot <working-dir> <packages...>`. + +**Where it still stops.** `mkarchroot <dir> base` against a live mirror +downloaded and installed the base set into the chroot (437 MB, 14 packages, +install scripts ran), then failed in devtools' init stage with +`Failed to parse --bind(-ro)= argument : Invalid argument` from +`systemd-nspawn` 262, and with `etc/pacman.conf` unreadable inside the root. +That is a devtools/nspawn interaction inside an unprivileged container, not +something this codebase controls. + +**What therefore remains unverified by execution:** `makechrootpkg`'s +copy-on-write snapshot semantics, `systemd-nspawn` isolation behaviour, and GPG +passphrase handling through a real agent. The shim tier drives the *unmodified* +pipeline against fake tools that produce real archives, and the crash tests kill +real processes with real signals, so the step machine, the checkpoints and the +publish path are all exercised for real — it is the chroot boundary itself that +is modelled rather than crossed. + +**How to run it properly.** A privileged Arch host (or a container with the +nspawn capabilities devtools expects), devtools installed, a real signing key, +`signing_key_id` set, `path_prepend` left unset so the real tools are found, then subscribe to a real pkgbase and drive it through `aur-build serve`. diff --git a/src/config.rs b/src/config.rs index 7effa53..9226622 100644 --- a/src/config.rs +++ b/src/config.rs @@ -37,6 +37,13 @@ pub struct Config { pub makechrootpkg_bin: String, /// Path to mkarchroot. pub mkarchroot_bin: String, + /// Package list handed to `mkarchroot` after the working directory, i.e. + /// what goes into the warm root. The default is the real devtools usage + /// (`mkarchroot <dir> base`); there is no `-N` flag on the real tool, so + /// hardcoding one would make the first real-chroot run fail on its first + /// step. Kept configurable because a site may want a smaller seed. + #[serde(default = "default_mkarchroot_args")] + pub mkarchroot_args: Vec<String>, /// Path to repo-add. pub repo_add_bin: String, /// Path to gpg. @@ -94,6 +101,7 @@ impl Default for Config { makepkg_bin: "makepkg".into(), makechrootpkg_bin: "makechrootpkg".into(), mkarchroot_bin: "mkarchroot".into(), + mkarchroot_args: default_mkarchroot_args(), repo_add_bin: "repo-add".into(), gpg_bin: "gpg".into(), build_user: String::new(), @@ -250,6 +258,10 @@ impl Config { } /// Filesystem-safe slug for a URL, used in cache filenames. +fn default_mkarchroot_args() -> Vec<String> { + vec!["base".to_string()] +} + pub fn slug(url: &str) -> String { url.chars() .map(|c| { diff --git a/src/pipeline/steps.rs b/src/pipeline/steps.rs index db7032c..50e41d3 100644 --- a/src/pipeline/steps.rs +++ b/src/pipeline/steps.rs @@ -120,7 +120,8 @@ fn chroot(ctx: &Ctx) -> Result<StepResult> { if !seed.exists() { std::fs::create_dir_all(seed.parent().unwrap_or(&ctx.cfg.chroot_dir()))?; let mut cmd = Command::new(&ctx.cfg.mkarchroot_bin); - cmd.args(["-N", &seed.display().to_string()]); + // Real devtools usage: `mkarchroot [options] <working-dir> <packages...>`. + cmd.arg(&seed).args(&ctx.cfg.mkarchroot_args); ctx.cfg.child_env(&mut cmd); let out = cmd.output()?; if !out.status.success() { diff --git a/src/shims/mod.rs b/src/shims/mod.rs index 46dd98f..5cf9ac7 100644 --- a/src/shims/mod.rs +++ b/src/shims/mod.rs @@ -307,7 +307,7 @@ fn plant_link_if_asked(startdir: &Path) { #[cfg(unix)] { let _ = std::fs::remove_file(&link); - if let Err(e) = std::fs::symlink(&target, &link) { + if let Err(e) = std::os::unix::fs::symlink(&target, &link) { eprintln!("shim: could not plant {link:?} -> {target}: {e}"); } } diff --git a/tests/invariants.rs b/tests/invariants.rs index 2bdbc8b..8234817 100644 --- a/tests/invariants.rs +++ b/tests/invariants.rs @@ -426,12 +426,13 @@ fn i9_a_build_cannot_smuggle_bytes_in_from_outside_its_own_staging_dir() { let out = pipeline::run(&env.cfg, &env.db, &id); env.cfg.shim_plant_link = None; - let err = match out { - Err(e) => e.to_string(), + let (step, err) = match out { + Ok(pipeline::Outcome::Failed { step, error, .. }) => (step, error), other => panic!("a build that smuggled in a symlink must fail closed, got {other:?}"), }; + assert_eq!(step, "collect", "it should be refused at collect, before anything is copied"); assert!( - err.contains("staging") || err.contains("symlink"), + err.contains("symlink") && err.contains("staging"), "the failure should say why it refused: {err}" ); |
