There is nothing more worthy of contempt than a man who quotes himself
- Zhasper, 2004



On Sun, Dec 14, 2008 at 11:38 PM, R.G.Salisbury
<[email protected]> wrote:
> Just sharing a gotcha with "rsync"  that caused me big trouble ...
>
> what's nasty about rsync ?    ..
> .. which may cause devastating consequences.
>
> rsync is in my opion the best thing since sliced bread... but be careful.
>
>
>
> CLI commands -- cp, rcp, scp, rsync, all have similarites
> BUT there are some nasty gotcha's when switching from one to another.
>
> You probably noticed some oddities , but had worked around it. (with the
> help of an error message)
> Without an error message you may had come to grief.
>
> Consider ..............
>
> Scenario:
> For whatever reason -- you want to restore  the /etc  directory from  a
> local backup.
> Lets just use a simple example..
>
> "cp"  should handle this.
> "rsync" should also should handle this.
>
>  But "cp" is your friend if you make an error ... "rsync" is not.
>
> OK  .... There is NO source or destinantion  directory "ets"  but you make a
> typo "ets" instead of "etc"
>
> "cp" will give you an error message whereas   "rsync"  will do what is not
> intended and you will be *unaware*
>
> So the following commands
>
> [r...@localhost ~]# cp      -a    /backup/etc/*   /ets
>
> [r...@localhost ~]# rsync -a    /backup/etc/*   /ets
>
>
> "cp" will error out telling you that the target  is not a directory

if you use cp -ar /backup/etc /etc, cp, won't give you a warning.

> whereas
> "rsync  will SILENTLY create the dir (ets) and populate it.

so add a "-v" and you'll see some output telling you "created directory ets".

This is not unusual. Most unix commands only bother you when there's a
problem, and there was no problem here.

Of course, you're going to ignore that output anyway, aren't you...
>
> So if you didn't check the result .... disaster beckons.

So check it.
>
> Note that the creation of directories occur without a trailing slash on the 
> source.
> But in that instance directory created is the name of the  source directory.

Note that blindly using *any* command, without paying attention,
without understanding what you're doing, can lead to disaster. This is
a PEBKAC, not a fault of the tool.

>
>
> I have found some other gotchas ...... But do be aware of this (nasty)
> feature.
> Won't go into detail .... but some are .........

No, please do!

> Like the deal with the trailing slash ..... which can cause issues ---
> (often put there by bashs tab completion).
> I like putting a "*" after a trailing slash as i find it more intuitive.
> Also ........ creating a new dir once -- but not twice..
> Blah..Blah
>
> Cheers
> Roger
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to