Commit graph

3 commits

Author SHA1 Message Date
vrubelroman
edf196a149 fix(transfer): clean up temp files left by a dead connection
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>
2026-11-01 04:15:40 +03:00
vrubelroman
86c110f0b1 feat(transfer): WriteAtomic and Execute for files, dirs and links (3.2)
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>
2026-11-01 04:00:31 +03:00
vrubelroman
76ae6c3a87 feat(transfer): request/plan types, FSSource and Prepare (3.1)
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>
2026-11-01 03:56:21 +03:00