dooblem / bsync

Bidirectional Synchronization using Rsync
GNU General Public License v3.0
289 stars 61 forks source link

Symlinks aren't followed #45

Open IslandC0der opened 4 years ago

IslandC0der commented 4 years ago

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.

dooblem commented 4 years ago

Thanks for your feedbak/idea.

There are more things to consider:

I would be glad to test if you have a working patched version.

IslandC0der commented 4 years ago

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.

IslandC0der commented 4 years ago

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

sdelanoue commented 4 years ago

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