The Samba-Bugzilla – Bug 6422
rsync needlessly aborts when getcwd() fails
Last modified: 2009-09-05 16:31:59 UTC
rsync will abort if getcwd() fails even though the current working directory is irrelevant to the request in question
for example, this should not fail:
mkdir -p src dst foo/a/b/c
rm -rf ~/foo
rsync -a ~/src/ ~/dst/
that rsync command errors out with:
rsync: getcwd(): No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at util.c(992) [receiver=3.0.6]
and looking in ~/dst/, i see no files have been transferred
There are all sorts of options and args that can depend on the current directory. If we allow the determination of what the current directory is to fail, we'd need to set a flag that the failure happened and then add code to every case that made sure that if curr_dir was used to construct a path that it should error out at that point. I don't think this is worth the complexity.
For scripts, you can add a "cd /" to make sure that your current directory is always valid.
i'd agree if i was attempting to do an actual operation on the current directory (like `rsync -a ./ foo:/`), but when the current directory is wholly irrelevant, it shouldnt fail imo
i wasnt running scripts, i was running rsync by hand in a terminal