Fail if current directory is deleted [rsync issue]
Describe the bug
I just got following error.
TIME: 4 - Cannot create replica file list in [/home/axel/sync/].
TIME: 4 - Cannot create replica file list in [/home/axel/sync/].
TIME: 4 - Truncated output:
rsync: [Receiver] getcwd(): No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at util1.c(1122) [Receiver=3.2.7]
TIME: 4 - Truncated output:
rsync: [Receiver] getcwd(): No such file or directory (2)
rsync error: errors selecting input/output files, dirs (code 3) at util1.c(1122) [Receiver=3.2.7]
To Reproduce The issue was the current working directory does not exist. (I deleted it in another window).
Albeit IMO the CWD shouldnt matter, should it?
Expected behavior It's up to you, either it should work, even if the CWD doesn't exit anymore on disk or maybe make a more better error message, took me a little while to figure out what was going on...
Well the error message is generated by the underlying rsync tool.
Also, if you read the example sync.conf file, you should have found CREATE_DIRS=true which is there for that exact reason.
CREATE_DIRS is true.
I think there is a misunderstanding, the error happens if the CWD (current working directory) is in a deleted directory when calling the tool.
However the CWD should play no role, I use absolute paths only.
Indeed, there was a misunderstanding. Nevertheless, I am unable to make any changes, since the error comes from rsync where you should perhaps report that bug.
Well you could change the CWD... or you could test for this situation and give a better error message..
For example: pwd -P || echo "this sucks"
It's no bigy tough, it's a rare edge case. Beeing regulary using osync happily for years now.
Change the cwd to what ? Current user home ? tmp ? There's no reasonable tool that should change the cwd for you. Imagine scripting and your tools play with the current path ^^
As for pwd -P I think I could add that check, even if I doubt it's worth the effort since googling the rsync error message already gives pretty clear explanations.
Well it doesnt change the CWD for me, unless you call anynthing with ". myscript.sh" when that tools the CWD it will be back as the environment of the caller will not be affected by what the callee does.
Dunno, do people use osync ever with relative paths? If so we shouldnt change the CWD since that would mess up their expectations, if its used with absolute paths, it makes sense to normalize the CWD (user home or root). When I wrote a daemon back the day, literature told me, I should change my CWD to root.
But I agree, ultimately it is rsync that is messing up, as the CWD shouldnt matter if its not called with a relative local dir.
PS: I can also simply do cd `pwd` || exit in my wrapper to osync.
Or better yet, just cd to go to home in my wrapper.
^^ Glad you figured it out. That's the script's job indeed, not the tool's job.
Okay, last time to waste your time on this. Sorry.
## Initiator is the system osync runs on. The initiator directory must be a local path.
INITIATOR_SYNC_DIR="/home/axel/sync"
I think 'CWD' should be set to INITIATOR_SYNC_DIR, and INITIATOR_SYNC_DIR being a relative path should be an error, no?