]> git.ipfire.org Git - thirdparty/rsync.git/commit
main: fix --mkpath + --dry-run file-to-file copy (#880)
authorAndrew Tridgell <andrew@tridgell.net>
Fri, 5 Jun 2026 01:29:18 +0000 (11:29 +1000)
committerAndrew Tridgell <andrew@tridgell.net>
Fri, 5 Jun 2026 01:51:30 +0000 (11:51 +1000)
commit3cd70a376107fcd50631facd111f9c5f4f3a71cb
tree5477989d486c585b6f4278420990807ae0c859ec
parent981ba2a7b1cf24f73e56c322c989eb9ec4e0629c
main: fix --mkpath + --dry-run file-to-file copy (#880)

A single-file --mkpath copy whose destination parent does not exist
failed under --dry-run: make_path() only *reports* the directories it
would create in a dry run, so change_dir#3 then tried to chdir into a
parent that isn't there and aborted with "change_dir#3 ... failed".

When the parent is genuinely missing in a dry run, skip the chdir and
mark the destination as not-yet-present (dry_run++), exactly as the
multi-file/dir-creation path already does, so the generator doesn't
probe the missing tree.  Gating it on the missing-parent case keeps an
ordinary file-to-file dry run chdir'ing into and itemizing against an
existing destination.

Fixes: #880
Co-authored-by: Stiliyan Tonev (Bark) <stiliyan21@gmail.com>
main.c