test(portal): point the relative escape link at the planted directory

The relative link in the race test climbed one level too high, so it
pointed at a directory that does not exist and could not catch a read
that left the granted directory.
This commit is contained in:
Marco Allegretti 2026-10-09 19:00:54 +00:00
parent ff1388c6d9
commit 0f4fafe701
No known key found for this signature in database

View file

@ -385,7 +385,8 @@ fn write(root: &Root, rest: &Path, data: &[u8]) -> Result<Response, Response> {
.map_err(Response::err)?; .map_err(Response::err)?;
static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0); static NEXT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
// Unique within this portal by the counter, and across restarts by the // Unique within this portal by the counter, and across restarts by the
// start time, so a file left by an earlier instance does not collide. // time of its first write, so a file left by an earlier instance does
// not collide.
static STARTED: std::sync::OnceLock<u128> = std::sync::OnceLock::new(); static STARTED: std::sync::OnceLock<u128> = std::sync::OnceLock::new();
let started = STARTED.get_or_init(|| { let started = STARTED.get_or_init(|| {
std::time::SystemTime::now() std::time::SystemTime::now()
@ -620,11 +621,7 @@ mod tests {
let swapper = { let swapper = {
let (granted, outside, stop) = (granted.clone(), dir.join("outside"), stop.clone()); let (granted, outside, stop) = (granted.clone(), dir.join("outside"), stop.clone());
std::thread::spawn(move || { std::thread::spawn(move || {
let targets = [ let targets = [PathBuf::from("real"), outside, PathBuf::from("../outside")];
PathBuf::from("real"),
outside,
PathBuf::from("../../outside"),
];
for target in targets.iter().cycle() { for target in targets.iter().cycle() {
if stop.load(std::sync::atomic::Ordering::Relaxed) { if stop.load(std::sync::atomic::Ordering::Relaxed) {
break; break;