bsync
bsync copied to clipboard
Symlinks aren't followed
I have a directory with a lot of symlinks (both files and dirs), and, when I sync it, the expected behavior would be for the actual file or directory to be synced, not the symlink itself. rsync
has the -L
flag which does exactly this, so I hope this wouldn't be too hard to implement:
In the same way that bsync
has the -o
flag to pass arguments to ssh
, I propose for there to be a similar flag that allows us to pass custom arguments to rsync
. However, this would require some further changes: for instance, to the code that generates the .bsync-snap
to account for when we want to follow symlinks (pass the -L
flag to find
).
However, I also had to edit the flags that are currently passed to rsync
by default, namely -a
which conflicts with -L
. According to man rsync
, -a
is the same as -rlptgoD
, so I just changed -a
to -rLptgoD
to test, and the rsync part worked.
Thanks for your feedbak/idea.
There are more things to consider:
- how do we handle circular symlinks
- do we need additionnal checks when symlinks to another filesystem type (permissions/modification date) may be different.
I would be glad to test if you have a working patched version.
Done, just sent a pull request. It would be nice to maybe add it as an option instead of hard-coding it. That said, I can't think of many cases where you'd want to copy the symlink itself instead of the file it actually points to, but let me know what you think.
Also, regarding circular symlinks: find
already detects them, and it will output an error, which will cause bsync to abort due to a "Find error".
Hi, please also consider that current behaviour is in most case more relevant ie. in my case I save the .wine directory witch have a sub-directory "game" that is a link to a directory on a SSD I don't want this simlink to be transformed to a regular directory or it content to be copied I rather have to issue 2 bsync command : 1 for .wine and 1 for the directory "game" on the SSD witch is exactly the current behaviour