forge
Explore
Log in

Don't you dare go Hollow

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 commit

08e885bcd9567a56c1d8e2316dab4c4aa0b3ad7dAhmet Kaan GümüşParent: 7ef8c05
Some 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
Show full message
🐛 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
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> {