You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chunked_copy for everyone! (except APFS)
- `copyfile(3)` ignores `COPYFILE_QUIT` when source or dest is on a network mount, causing cancellation to take 30+ seconds or silently complete the full copy
- On macOS, now use `copyfile(3)` only for same-APFS-volume copies (the only case where clonefile works); use chunked copy for everything else
- Check cancellation after `copyfile` returns regardless of result code (safety net for when `copyfile` returns 0 despite `COPYFILE_QUIT`)
- Deduplicate cancellation log messages via `AtomicBool` (was logging ~1000 identical lines while buffers drained)
- On Linux, check both source and destination for network filesystem (was only checking dest)
- Delete macOS `is_network_filesystem` (replaced by `is_same_apfs_volume` in copy strategy)
- Evaluated `copyfile` on HFS+, exFAT, FAT32, NTFS-3G — no practical benefit over chunked copy on any of them
Entire-Checkpoint: 88f2e62bb2e6
|`copy_strategy.rs`| Strategy selection per file: network FS → chunked copy; overwrite → temp+rename; macOS → `copyfile(3)`; Linux → `copy_file_range(2)`. |
25
25
|`macos_copy.rs`| FFI to macOS `copyfile(3)`. Preserves xattrs, ACLs, resource forks, Finder metadata. Supports APFS `clonefile`. |
26
26
|`linux_copy.rs`| Linux `copy_file_range(2)` with reflink support on btrfs/XFS. 4 MB chunks, cancellation between iterations. |
27
-
|`chunked_copy.rs`| 1 MB chunked read/write for network mounts. Checks cancellation between chunks. Copies xattrs, ACLs, timestamps. |
27
+
|`chunked_copy.rs`| 1 MB chunked read/write — the default copy method for all non-APFS-clonefile copies on macOS and network copies on Linux. Checks cancellation between chunks. Copies xattrs, ACLs, timestamps. |
28
28
|`volume_copy.rs`, `volume_conflict.rs`, `volume_strategy.rs`| Volume-to-volume copy (Local↔MTP abstraction). Publicly re-exported from `mod.rs` and at least partially wired up. |
29
29
|`tests.rs`, `integration_test.rs`| Unit and integration tests. |
30
30
@@ -82,10 +82,10 @@ actual `copy_files_start` can consume the cache via `preview_id` in `WriteOperat
82
82
`.cmdr-staging-<uuid>` dir at the destination root, then atomic `rename` into place, then source deletion.
83
83
84
84
**Copy strategy selection** (`copy_strategy.rs`):
85
-
-Destination is a network mount → `chunked_copy_with_metadata` (macOS `copyfile` ignores `COPYFILE_QUIT` on network mounts)
- Linux, local → `copy_single_file_linux` (`copy_file_range(2)`, supports reflink on btrfs/XFS)
89
89
- Other platforms → `std::fs::copy` fallback
90
90
91
91
**Trash has no scan phase.**`trashItemAtURL` is atomic per top-level item (the OS moves the entire tree), so trash
@@ -125,6 +125,27 @@ operations when the frontend is destroyed.
125
125
**Decision**: Keep `exacl` crate for ACL copy in chunked copies (not custom FFI bindings).
126
126
**Why**: `exacl` adds zero new transitive dependencies (all of its deps — `bitflags`, `log`, `scopeguard`, `uuid` — are already in our tree). It provides cross-platform ACL support (macOS, Linux, FreeBSD) and full ACL parsing/manipulation for potential future UI features. The crate appears unmaintained (last release Feb 2024) but ACL APIs are stable and don't change. Our usage is best-effort with graceful fallback — if `exacl` ever breaks, files still copy, they just lose ACLs. MIT licensed (compatible with BSL).
127
127
128
+
**Decision**: On macOS, use `copyfile(3)` only for same-APFS-volume copies; use chunked copy for everything else.
129
+
**Why**: The only practical benefit of `copyfile(3)` is APFS clonefile (instant copy-on-write, zero extra disk usage),
130
+
which only works on the same APFS volume. We evaluated `copyfile` on other filesystems:
131
+
-**HFS+**: No clonefile. Marginal metadata edge (birthtime, file flags), but HFS+ is rare since Apple converted all
132
+
Macs to APFS in 2017.
133
+
-**exFAT / FAT32**: No clonefile, no xattrs, no ACLs, no file flags — the metadata `copyfile` would preserve doesn't
134
+
exist on these filesystems. No practical benefit.
135
+
-**NTFS-3G**: FUSE-based, so `copyfile` goes through userspace with the same I/O buffering issues as network mounts.
0 commit comments