On Mon, Jul 29, 2002 at 12:40:56PM +1000, Martin Pool wrote: > On 28 Jul 2002, Michael Wang <[EMAIL PROTECTED]> wrote: > > rsync does not sync the timestamp on symlink (Solaris 8). > > > > It is probablly due to the limitation of Unix implementation > > of symlink, but I would like to know why rsync/Unix does not > > do this, and what we can do about it. Is the conclusion that > > "rsync syncs everything except the timestamp on symlink"? > > I don't think it is possible to set the time of a symbolic link. A > quick experiment on Linux seems to confirm that: > > !891 12:36 ~% python2.2 > Python 2.2.1 (#1, May 3 2002, 23:19:03) > [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> import os > >>> os.symlink('nothere', '/tmp/mylink') > >>> os.utime('/tmp/mylink', None) > Traceback (most recent call last): > File "<stdin>", line 1, in ? > OSError: [Errno 2] No such file or directory: '/tmp/mylink'
This is because most of python's os.xxx methods de-reference symlinks. You get this error because 'nothere' doesn't exist. The correct way to get time info on symlinks is to use os.lstat(), which doesn't de-reference links. Python 2.1.3 (#1, Apr 20 2002, 10:14:34) [GCC 2.95.4 20011002 (Debian prerelease)] on linux2 Type "copyright", "credits" or "license" for more information. >>> import os >>> os.symlink('nothere','mylink') >>> os.lstat('mylink') (41471, 64782L, 10L, 1, 1000, 1000, 7L, 1027913015, 1027913005, 1027913005) >>> -- ---------------------------------------------------------------------- ABO: finger [EMAIL PROTECTED] for more info, including pgp key ---------------------------------------------------------------------- -- To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html