Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
rsync man page (-R)
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
friesia
Apprentice
Apprentice


Joined: 23 Mar 2007
Posts: 185

PostPosted: Sat Apr 27, 2013 12:11 pm    Post subject: rsync man page (-R) Reply with quote

I can't realize what it says here about -R option in rsync man page.
Maybe someone can make an example?

Quote:

-R, --relative
<skipped>

Beginning with rsync 3.0.0, rsync always sends these implied directories as real directories in the file
list, even if a path element is really a symlink on the sending side. This prevents some really unexpected
behaviors when copying the full path of a file that you didn’t realize had a symlink in its path. If you
want to duplicate a server-side symlink, include both the symlink via its path, and referent directory via
its real path. If you’re dealing with an older rsync on the sending side, you may need to use the
--no-implied-dirs option.
Back to top
View user's profile Send private message
tomk
Administrator
Administrator


Joined: 23 Sep 2003
Posts: 7219
Location: Sat in front of my computer

PostPosted: Sat Apr 27, 2013 12:40 pm    Post subject: Reply with quote

I just used this yesterday. Say you have a structure like this:

Code:
/dir1/foo
/dir1/bar
/dir2/baz


And you run this command:

Code:
rsync -avz /dir1 /dir2 host:/dir3


You will end up with this:

Code:
/dir3/foo
/dir3/bar
/dir3/baz


If you use:

Code:
rsync -avzR /dir1 /dir2 host:/dir3


You end up with this:

Code:
/dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir2/baz


It comes in very handy if you are rsyncing several directories at once.
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
friesia
Apprentice
Apprentice


Joined: 23 Mar 2007
Posts: 185

PostPosted: Sat Apr 27, 2013 4:04 pm    Post subject: Reply with quote

I understand what -R does (I skipped this part), I can't get the part about symlinking
Back to top
View user's profile Send private message
tomk
Administrator
Administrator


Joined: 23 Sep 2003
Posts: 7219
Location: Sat in front of my computer

PostPosted: Sat Apr 27, 2013 8:34 pm    Post subject: Reply with quote

Ah OK, the problem it is getting round is that you could end up overwriting files on the receiving side you didn't intend to. So if you have a symlink in your structure:

Code:
/dir1/foo
/dir1/bar
/dir2/baz
/dir4 -> /dir2


And you run the following:

Code:
rsync -avzR /dir1 /dir4/baz host:/dir3


You end up with this on the receiving side:

Code:
/dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir4/baz


If rsync copied the implied directory (/dir4/) as a symlink you would end up with this:

Code:
/dir3/dir1/foo
/dir3/dir1/bar
/dir3/dir4/ -> /dir2/
/dir2/baz


If you didn't realise that /dir4 was a symlink you've just written /dir2/baz without intending to. Say /dir2/ was /etc/ you could have done a lot of damage.

Does that make it any clearer?
_________________
Search | Read | Answer | Report | Strip
Back to top
View user's profile Send private message
friesia
Apprentice
Apprentice


Joined: 23 Mar 2007
Posts: 185

PostPosted: Sun Apr 28, 2013 6:04 am    Post subject: Reply with quote

Yes, it's clear now, thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum