Job overlay mounts with userxattr so directory renames work in a user namespace (dpkg/apt failed with EXDEV), falling back to the plain mount on older kernels
Browse files at this commit08e885bcd9567a56c1d8e2316dab4c4aa0b3ad7dParent: 7ef8c05Some checks failed
Show checks
ci/buildjob was cancelledDetails
- fix
- job overlay mounts with userxattr so directory renames work in a user namespace (dpkg/apt failed with EXDEV), falling back to the plain mount on older kernels
1 changed file +12 -8
crates/forge-runner/src/sandbox/helper.rsmodified+12 -8
| @@ -254,14 +254,18 @@ fn mount_overlay(lower: &Path, layout: &Layout) -> Result<(), SandboxError> { | |||
| 254 | layout.upper.display(), | 254 | layout.upper.display(), |
| 255 | layout.work.display() | 255 | layout.work.display() |
| 256 | ); | 256 | ); |
| 257 | - mount( | 257 | + let overlay = |options: &str| { |
| 258 | - Some("overlay"), | 258 | + mount( |
| 259 | - layout.merged.as_path(), | 259 | + Some("overlay"), |
| 260 | - Some("overlay"), | 260 | + layout.merged.as_path(), |
| 261 | - MsFlags::empty(), | 261 | + Some("overlay"), |
| 262 | - Some(options.as_str()), | 262 | + MsFlags::empty(), |
| 263 | - ) | 263 | + Some(options), |
| 264 | - .map_err(|e| SandboxError::Setup(e.to_string())) | 264 | + ) |
| 265 | + }; | ||
| 266 | + overlay(&format!("{options},userxattr")) | ||
| 267 | + .or_else(|_| overlay(&options)) | ||
| 268 | + .map_err(|e| SandboxError::Setup(e.to_string())) | ||
| 265 | } | 269 | } |
| 266 | 270 | ||
| 267 | fn copy_rootfs(src: &Path, dst: &Path) -> Result<(), SandboxError> { | 271 | fn copy_rootfs(src: &Path, dst: &Path) -> Result<(), SandboxError> { |