diff options
Diffstat (limited to 'src/shims')
| -rw-r--r-- | src/shims/mod.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/shims/mod.rs b/src/shims/mod.rs index 754bbb4..46dd98f 100644 --- a/src/shims/mod.rs +++ b/src/shims/mod.rs @@ -291,9 +291,28 @@ pub fn makechrootpkg(args: &[String], m: &Manifest) -> Result<i32, String> { } } } + plant_link_if_asked(&startdir); Ok(0) } +/// I9 test hook: drop a symlink into the srcdir pointing wherever the test names, +/// standing in for a PKGBUILD that tries to smuggle outside bytes into the +/// artifact store. The pipeline must refuse it; see `collect` in steps.rs. +fn plant_link_if_asked(startdir: &Path) { + let target = match std::env::var("AUR_SHIM_PLANT_LINK") { + Ok(t) if !t.is_empty() => t, + _ => return, + }; + let link = startdir.join("planted.pkg.tar.zst"); + #[cfg(unix)] + { + let _ = std::fs::remove_file(&link); + if let Err(e) = std::fs::symlink(&target, &link) { + eprintln!("shim: could not plant {link:?} -> {target}: {e}"); + } + } +} + fn packages_to_emit(m: &Manifest, startdir: &Path) -> Vec<FakePackage> { if !m.packages.is_empty() { return m.packages.clone(); |
