Skip to content

Commit 0750d9a

Browse files
committed
Skip missing writable roots in bwrap args
1 parent 7df7507 commit 0750d9a

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
@@ -344,6 +344,9 @@ fn create_filesystem_args(
344344

345345
for writable_root in &sorted_writable_roots {
346346
let root = writable_root.root.as_path();
347+
if !root.exists() {
348+
continue;
349+
}
347350
let symlink_target = canonical_target_if_symlinked_path(root);
348351
// If a denied ancestor was already masked, recreate any missing mount
349352
// target parents before binding the narrower writable descendant.
@@ -1089,7 +1092,10 @@ mod tests {
10891092
"existing writable root should be rebound writable",
10901093
);
10911094
assert!(
1092-
!args.args.iter().any(|arg| arg == &missing_root),
1095+
!args
1096+
.args
1097+
.iter()
1098+
.any(|arg| arg == &missing_root || arg.starts_with(&(missing_root.clone() + "/"))),
10931099
"missing writable root should be skipped",
10941100
);
10951101
}

0 commit comments

Comments
 (0)