Skip to content

fix(disk,runtime): cross-filesystem-safe clone/snapshot moves (EXDEV fallback)#624

Open
G4614 wants to merge 1 commit into
boxlite-ai:mainfrom
G4614:fix/clone-move-exdev-safe
Open

fix(disk,runtime): cross-filesystem-safe clone/snapshot moves (EXDEV fallback)#624
G4614 wants to merge 1 commit into
boxlite-ai:mainfrom
G4614:fix/clone-move-exdev-safe

Conversation

@G4614
Copy link
Copy Markdown
Contributor

@G4614 G4614 commented May 29, 2026

rename cannot be operated between different mounted file systems (eg. /tmp mounted independently )

Test plan

Two-sided (fix reverted vs applied), the clone/snapshot/export integration tests, run with the per-test box home on a tmpfs /tmp and the base store on an ext4 disk (i.e. different filesystems):

  • clone_export_import (9) + snapshot_clone_deep (28) — clone / snapshot-clone / export-import flows that promote a disk to the base store and/or move an import staging dir into boxes/.
observed pre-fix (disk/mod.rs + rt_impl.rs reverted) post-fix
disk promotion (fork_qcow2) Storage("Failed to move disk … : Invalid cross-device link (os error 18)") copies across fs, succeeds
staging-dir move (provision_box) Storage("Failed to rename …/staging → …/boxes/… : Invalid cross-device link") recursive-copies across fs, succeeds
test result 37 FAIL (cross-device) clone 28/28 + export 15/15 PASS

archive.rs::move_file already handled EXDEV; this brings the clone/snapshot move paths in line. Same-filesystem setups (most CI) take the plain rename fast path and are unaffected.

Clone/snapshot base promotion (fork_qcow2) and import/clone box
provisioning (provision_box) moved files/dirs with a bare std::fs::rename,
which fails with EXDEV ("Invalid cross-device link") when the source (box
home / staging) and destination (base store / boxes dir) live on different
filesystems — e.g. a tmpfs scratch area vs the on-disk data dir.

- fork_qcow2: fall back to copy + remove on EXDEV (matches the existing
  archive::move_file helper).
- provision_box: fall back to recursive copy + remove_dir_all on EXDEV
  (directory move; std::fs::copy can't copy a tree). Symlinks preserved.

Fixes ~37 clone/snapshot/export integration tests that run with the box
home on tmpfs and the base store on the repo disk.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@G4614 G4614 marked this pull request as ready for review May 29, 2026 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant