Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail if current directory is deleted [rsync issue] #269

Open
axkibe opened this issue Jan 2, 2025 · 9 comments
Open

Fail if current directory is deleted [rsync issue] #269

axkibe opened this issue Jan 2, 2025 · 9 comments

Comments

@axkibe
Copy link

axkibe commented Jan 2, 2025

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...

@deajan
Copy link
Owner

deajan commented Jan 2, 2025

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.

@deajan deajan closed this as completed Jan 2, 2025
@deajan deajan added the invalid label Jan 2, 2025
@axkibe
Copy link
Author

axkibe commented Jan 2, 2025

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.

@deajan
Copy link
Owner

deajan commented Jan 2, 2025

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.

@axkibe
Copy link
Author

axkibe commented Jan 2, 2025

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.

@deajan
Copy link
Owner

deajan commented Jan 2, 2025

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.

@deajan deajan self-assigned this Jan 2, 2025
@deajan deajan reopened this Jan 2, 2025
@deajan deajan changed the title Fail if current directory is deleted Fail if current directory is deleted [rsync issue] Jan 2, 2025
@axkibe
Copy link
Author

axkibe commented Jan 2, 2025

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.

@axkibe
Copy link
Author

axkibe commented Jan 2, 2025

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.

@deajan
Copy link
Owner

deajan commented Jan 2, 2025

^^ Glad you figured it out. That's the script's job indeed, not the tool's job.

@axkibe
Copy link
Author

axkibe commented Jan 2, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants