rsync to a symlink directory

tim.conway at philips.com tim.conway at philips.com
Tue Sep 24 18:58:00 EST 2002


Here's the script:
++++++++++++++++++++++++++++++++++++++++++++++++++++
#!/bin/sh

{
echo starting on `uname -a`
rm -rf dira dirb dirc
mkdir dira
mkdir dirb
ln -s dirb dirc
date >dira/file
rsync dira/file dirc
ls -ld `find dirb -print`
echo finished on `uname -a`
} >> $HOME/netapp/rsyncsymlinktest.log 2>&1
++++++++++++++++++++++++++++++++++++++++++++++++++++
and here's the output, run on 4 different architectures:
++++++++++++++++++++++++++++++++++++++++++++++++++++
starting on CYGWIN_NT-5.0 USB-FLATUS 1.3.12(0.54/3/2) 2002-07-06 02:16 
i586 unknown
drwxr-xr-x    2 tconway  None         4096 Sep 24 12:52 dirb
-rw-r--r--    1 tconway  None           26 Sep 24 12:52 dirb/file
finished on CYGWIN_NT-5.0 USB-FLATUS 1.3.12(0.54/3/2) 2002-07-06 02:16 
i586 unknown
starting on HP-UX vail B.11.00 U 9000/800 1119484627 unlimited-user 
license
drwxr-xr-x    2 tconway  Vlsieng      4096 Sep 24 12:52 dirb
-rw-r--r--    1 tconway  Vlsieng        29 Sep 24 12:52 dirb/file
finished on HP-UX vail B.11.00 U 9000/800 1119484627 unlimited-user 
license
starting on SunOS atlas 5.7 Generic_106541-18 sun4u sparc SUNW,Ultra-5_10
drwxr-xr-x    2 tconway  Vlsieng      4096 Sep 24 12:53 dirb
-rw-r--r--    1 tconway  Vlsieng        29 Sep 24 12:53 dirb/file
finished on SunOS atlas 5.7 Generic_106541-18 sun4u sparc SUNW,Ultra-5_10
starting on Linux arwen.ustc.sc.philips.com 2.4.18-6mdkenterprise #1 SMP 
Fri Mar 15 02:28:20 CET 2002 i686 unknown
drwxr-xr-x    2 tconway  Vlsieng      4096 Sep 24 12:53 dirb
-rw-r--r--    1 tconway  Vlsieng        29 Sep 24 12:53 dirb/file
finished on Linux arwen.ustc.sc.philips.com 2.4.18-6mdkenterprise #1 SMP 
Fri Mar 15 02:28:20 CET 2002 i686 unknown
++++++++++++++++++++++++++++++++++++++++++++++++++++
What platform are you on?  What's the version of rsync?  What's the 
filesystem?


Tim Conway
tim.conway at philips.com
303.682.4917 office, 303.921.0301 cell
Philips Semiconductor - Longmont TC
1880 Industrial Circle, Suite D
Longmont, CO 80501
Available via SameTime Connect within Philips, caesupport2 on AIM
"There are some who call me.... Tim?"




Sriram Ramkrishna <sramkris at ichips.intel.com>
Sent by: rsync-admin at lists.samba.org
09/24/2002 10:19 AM

 
        To:     Gwendal Stevanazzi <stevanazzi at aleks.com>
        cc:     jw schultz <jw at pegasys.ws>
rsync at lists.samba.org
(bcc: Tim Conway/LMT/SC/PHILIPS)
        Subject:        Re: rsync to a symlink directory
        Classification: 



I've always tried just appending a trailing slash to the destination
that always worked for me.

sri

On Tue, Sep 24, 2002 at 12:28:02AM -0700, Gwendal Stevanazzi wrote:
> On Mon, 23 Sep 2002, jw schultz wrote:
> 
> > On Mon, Sep 23, 2002 at 06:03:12PM -0700, Gwendal Stevanazzi wrote:
> > >
> > > Here is the structure of my servers :
> > >
> > > Source :
> > >
> > > /home/test1/link_dir
> > >                 sub_dir1
> > >                       file1
> > >                       file2
> > >                       ...
> > >                 sub_dir2
> > >                 ...
> > >
> > > Destination:
> > >
> > > /home/test2/real_dir
> > >                 sub_dir1
> > >                       file1
> > >                       file2
> > >                       ...
> > >                 subdir2
> > >                       ...
> > > /home/test2/link_dir@ -> real_dir
> > >
> > >
> > >
> > > Now I want to update file1.
> > > If I run the command
> > > rsync -aRz file1 destination:/home/test2/link_dir/sub_dir1
> > > from /home/test1/link_dir/sub_dir1 on source, no problem, the file 
is
> > > updated.
> > >
> > > If I run the command
> > > rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/
> > > from /home/test1 on source, the new fs structure on destination is:
> > >
> > > /home/test2/real_dir
> > >                 sub_dir1
> > >                       file1
> > >                       file2
> > >                       ...
> > >                 subdir2
> > >                       ...
> > >
> > > /home/test2/link_dir
> > >                 sub_dir1
> > >                       file1
> > >
> > > The symlink is erase and replace by a 'real' directory.
> > >
> > >
> > > Is it the expected behaviour?
> > >
> > > How could I prevent this kind of things to happen ?
> >
> > It is inferred because you haven't yet traversed the link
> > and since rsync doesn't see a directory it will create one.  Try
> > rsync -aRz link_dir/sub_dir1/file1 destination:/home/test2/./
> > to force the traversal of the link so it is already inside
> > the destination.
> 
> Thanks for your quick answer, but unforunately it didn't work any 
better.
> 
> Here is the output of the command with -v and --stats if it helps:
> 
> building file list ... done
> link_dir/
> link_dir/sub_dir1/
> link_dir/sub_dir1/file1
> rsync[17349] (server receiver) heap statistics:
>   arena:         123544   (bytes from sbrk)
> rsync[17347] (sender) heap statistics:
>   arena:         336536   (bytes from sbrk)
>   ordblks:            2   (chunks not in use)
>   smblks:             0
>   hblks:              0   (chunks from mmap)
>   hblkhd:             0   (bytes from mmap)
>   usmblks:            0
>   fsmblks:            0
>   uordblks:      326880   (bytes used)
>   fordblks:        9656   (bytes free)
>   keepcost:        5560   (bytes in releasable chunk)
> 
> Number of files: 3
> Number of files transferred: 1
> Total file size: 266240 bytes
> Total transferred file size: 266240 bytes
> Literal data: 266240 bytes
> Matched data: 0 bytes
> File list size: 96
> Total bytes written: 266517
> Total bytes read: 36
> 
> wrote 266517 bytes  read 36 bytes  533106.00 bytes/sec
> total size is 266240  speedup is 1.00
> 
> 
> This test was done with rsync  version 2.5.6cvs  protocol version 26
> but I don't think it matters ...
> 
> 
> -- 
> Gwen
> 
> -- 
> To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/rsync
> Before posting, read: 
http://www.tuxedo.org/~esr/faqs/smart-questions.html
-- 
To unsubscribe or change options: 
http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html






More information about the rsync mailing list