[BUG][high] --partial --partial-dir DIR writes completed files into DIR and never installs them in the destination #253

Closed
opened 2026-09-05 12:08:20 +02:00 by TapTap · 1 comment
Owner

Found by code review + empirical test of dev (9f8b588).

Where: src/shared/file_receive.c:60-63 (actual_root = partial dir whenever partial && partial_dir), :143-151 (write target = partial dir); no rename-back step exists anywhere.

Problem: When both --partial and --partial-dir are set, disk_path is under the partial dir for every file and nothing renames completed files into the real destination. On a fully successful run the destination tree is empty and all files sit under dest/partial-dir (verified). Subsequent runs re-transfer everything.

Fix: After a successful write to the partial dir, atomically rename into root_directory; keep file in partial dir only when transfer is interrupted/fails.

Regression test required (integration).

Found by code review + empirical test of `dev` (9f8b588). **Where:** src/shared/file_receive.c:60-63 (`actual_root` = partial dir whenever partial && partial_dir), :143-151 (write target = partial dir); no rename-back step exists anywhere. **Problem:** When both `--partial` and `--partial-dir` are set, disk_path is under the partial dir for *every* file and nothing renames completed files into the real destination. On a fully successful run the destination tree is empty and all files sit under dest/partial-dir (verified). Subsequent runs re-transfer everything. **Fix:** After a successful write to the partial dir, atomically rename into root_directory; keep file in partial dir only when transfer is interrupted/fails. Regression test required (integration).
Author
Owner

Resolved on dev (HEAD f7c6c91).

Fixed on dev via fix/receiver-correctness (14c064a): completed partial-dir writes are atomically renamed into the destination (file_rename_secure). Integration TestPartialDir added.

CI run #461: all jobs green (lint, build-and-test, sanitizers address+undefined, fuzz-build, coverage, valgrind). Unit 25/25, integration 83 passed / 10 skipped / 1 xpassed. Closing.

**Resolved on `dev`** (HEAD f7c6c91). Fixed on dev via fix/receiver-correctness (14c064a): completed partial-dir writes are atomically renamed into the destination (file_rename_secure). Integration TestPartialDir added. CI run #461: all jobs green (lint, build-and-test, sanitizers address+undefined, fuzz-build, coverage, valgrind). Unit 25/25, integration 83 passed / 10 skipped / 1 xpassed. Closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: TapTap/FastSync#253