timestamp on symlink
Martin Pool
mbp at samba.org
Sun Jul 28 19:45:02 EST 2002
On 28 Jul 2002, Michael Wang <mwang at mindspring.com> 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'
The Sun manpage doesn't comment on how they think this ought to work,
so presumably they're trying to update the link's target too.
You will need to do a backup below the filesystem API (e.g. using
dump) if you want to preserve them, as far as I can see.
> Why do I need timestamp on symlink? Supposed something stopped
> working because something removed the link, and then remake
> the link. If all I have is the rsync copy, then I would have
> a wrong conclusion, for example, that "nobody touched the directory
> since last night."
You will see that the directory's modification time has changed; you
will also see that the new symlink has a later time than that in the
backup.
> [root at emily:/tmp]ls -ls a/copying b/copying
> 8 lrwxrwxrwx 1 root other 7 Jul 28 12:09 a/copying -> COPYING
> 8 lrwxrwxrwx 1 root other 7 Jul 28 12:07 b/copying -> COPYING
>
> [root at emily:/tmp]rsync -avn /tmp/a/ /tmp/b
> building file list ... done
> wrote 25424 bytes read 20 bytes 16962.67 bytes/sec
> total size is 15972287 speedup is 627.74
>
> [root at emily:/tmp]rsync -av /tmp/a/ /tmp/b
> building file list ... done
> ./
> wrote 25424 bytes read 20 bytes 16962.67 bytes/sec
> total size is 15972287 speedup is 627.74
>
> [root at emily:/tmp]ls -ls a/copying b/copying
> 8 lrwxrwxrwx 1 root other 7 Jul 28 12:09 a/copying -> COPYING
> 8 lrwxrwxrwx 1 root other 7 Jul 28 12:07 b/copying -> COPYING
What is this example meant to demonstrate?
--
Martin
More information about the rsync
mailing list