Symbolic links on Mac OSX

Matt McCutchen hashproduct+rsync at gmail.com
Tue Jul 24 22:34:04 GMT 2007


On 4/25/07, smokin.jake at mac.com <smokin.jake at mac.com> wrote:
> I have noticed an anomaly with symbolic links.
>
> umask 027
> mkdir folder1
> echo 'hello world' > folder1/file1
> cd folder1
> ln -s file1 softfile1
> rsync -a ../folder1/ ../folder2/
> ls -lF ../folder*
>
> ../folder1:
> total 16
> -rw-r-----   1 alan  alan  12 Apr 26 00:00 file1
> lrwxr-x---   1 alan  alan   5 Apr 26 00:02 softfile1@ -> file1
>
> ../folder2:
> total 16
> -rw-r-----   1 alan  alan  12 Apr 26 00:00 file1
> lrwxrwxrwx   1 alan  alan   5 Apr 26 00:03 softfile1@ -> file1
>
> The symbolic link has a new creation time and different permissions.
> I am using rsync version 3.0.0cvs  protocol version 30.PR2
> The Apple rsync  version 2.6.3  protocol version 28
> gives the same result.
>
> Is this a MacOSX quirk that I don't need to worry about.

Yes.  According to
http://lists.apple.com/archives/Darwin-kernel/2006/Dec/msg00054.html ,
Mac OS X (Darwin) does not provide the lchmod and lutimes system calls
necessary to set symlink mtimes and permissions arbitrarily.  Thus,
rsync leaves the second symlink with its default mtime (the current
time) and its default permissions (777 minus rsync's umask, which it
sets to 0).  Some more information about symlink permissions on Mac OS
X is at http://unsanity.org/archives/000463.php .

Matt


More information about the rsync mailing list