When the ctx a remote file was opened with is cancelled while one of its
operations is still stuck, probe the connection after a short grace
period and tear it down if the keepalive goes unanswered. A cancel in the
middle of a file on a frozen network now returns in about 2 s with the
default keepalive instead of up to 40 s; a slow but live link is left
alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A failed write whose temp file cannot be removed (the connection is gone)
is remembered by the executor and removed again on Retry (typically after
the pool reconnected inside OnError) and at the end of Execute; whatever
still cannot be removed is named in Report.Warnings. Prepare now always
lists ToDir once (instead of a Lstat per root), so leftovers next to a
single top-level file are reported too. TestOverwriteThenDrop checks this
strictly, TestOverwriteThenDropRetryLeavesNoTemp covers the retry path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Run the key transfer scenarios over sftpfs: overwrite cut mid-file keeps
the old file (N-P0-4), the same file through two aliases is refused and
never truncated (N-P0-5), broken symlinks up and down (N-P1-8), mode and
mtime (N-P1-9), remote to remote between users (N-P1-10), retry after a
lost connection (N-P1-2), cancel and freeze in the middle of a file.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With SameConn a top-level item without a target is renamed whole
(NoReplace), and files merged into an existing directory are renamed one by
one; EXDEV or any rename failure falls back to copy. Otherwise each file or
link is copied, its size checked and only then removed from the source
(Remove never follows links: N-P0-3); source directories are removed
bottom-up only when empty, so skipped and failed items stay in place.
Links are always moved as links (FollowLinks is ignored for a move: N-P1-8).
Affected includes the source directories.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A cancel 150 ms into a slow 3 MiB overwrite returns within 200 ms with
Report.Cancelled (not success), keeps the old target, copies nothing after
it and leaves no temp (N-P1-7); a cancelled Prepare stops walking and
writes nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ask with ApplyToAll, Abort, OverwriteOlder, KeepBoth naming ("name (1).ext",
.tar.gz kept together, dot-files and dirs unsplit), a file/dir type mismatch
is never overwritten, a target that appears after Prepare is a conflict
(NoReplace commit), Retry after a write error, SkipRest/SkipAll/Abort and
the Report counters and Affected list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every file is written to .vcom-part-<rand>-<name>, closed (a Close error
fails the item: N-P2-6), chmod/chtimes'ed and only then renamed over the
target, so a failed or cancelled overwrite keeps the old file (N-P0-4) and
leaves no temp. Without atomic replace the old file is renamed aside and
restored on failure. Directories are merged, never replaced (N-P0-7), and
get their real mode/mtime post-order (N-P1-17); symlinks are copied as
links, broken ones too (N-P1-8); mode and mtime are preserved (N-P1-9);
FIFOs and devices are skipped with a warning. The copy loop goes through a
ctx-aware reader with Size() and throttled byte progress. Conflict and
error policies are wired in here; their tests follow in 3.3.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Prepare refuses a read-only or non-directory target, a root that is the
same file as its target (also through a symlinked directory: N-P0-6) and a
directory copied into itself; walks the source once (links as links, or
followed with loop detection); lists each existing target directory once
instead of a stat per file (N-P2-4/5); fills Existing and the per-file
Conflicts and computes exact TotalFiles/TotalBytes (N-P1-13).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>