Skip to content

Commit 3a0343b

Browse files
committed
Skip missing writable roots in bwrap args
1 parent 53960a9 commit 3a0343b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

codex-rs/linux-sandbox/src/bwrap.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,9 @@ fn create_filesystem_args(
394394

395395
for writable_root in &sorted_writable_roots {
396396
let root = writable_root.root.as_path();
397+
if !root.exists() {
398+
continue;
399+
}
397400
let symlink_target = canonical_target_if_symlinked_path(root);
398401
// If a denied ancestor was already masked, recreate any missing mount
399402
// target parents before binding the narrower writable descendant.
@@ -1448,7 +1451,10 @@ mod tests {
14481451
"existing writable root should be rebound writable",
14491452
);
14501453
assert!(
1451-
!args.args.iter().any(|arg| arg == &missing_root),
1454+
!args
1455+
.args
1456+
.iter()
1457+
.any(|arg| arg == &missing_root || arg.starts_with(&(missing_root.clone() + "/"))),
14521458
"missing writable root should be skipped",
14531459
);
14541460
}

0 commit comments

Comments
 (0)