Skip to content

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

Open

Description

@axkibe

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

Activity

  1. deajan commented on Jan 2, 2025

    @deajan
    Owner

    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.

  2. axkibe commented on Jan 2, 2025

    @axkibe
    Author

    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.

  3. deajan commented on Jan 2, 2025

    @deajan
    Owner

    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.

  4. axkibe commented on Jan 2, 2025

    @axkibe
    Author

    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.

  5. deajan commented on Jan 2, 2025

    @deajan
    Owner

    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.

  6. self-assigned this
    on Jan 2, 2025
  7. reopened this on Jan 2, 2025
  8. changed the title [-]Fail if current directory is deleted[/-] [+]Fail if current directory is deleted [rsync issue][/+] on Jan 2, 2025
  9. axkibe commented on Jan 2, 2025

    @axkibe
    Author

    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.

  10. axkibe commented on Jan 2, 2025

    @axkibe
    Author

    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.

  11. deajan commented on Jan 2, 2025

    @deajan
    Owner

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

  12. axkibe commented on Jan 2, 2025

    @axkibe
    Author

    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

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions