trouble with chmod on certain symlinks

btb btb at bitrate.net
Fri Dec 31 03:19:42 GMT 2004


thanks.  i will give the patch a try.  i've got to be missing 
something...  what if someone wanted to chown a symlink?  bizarre.

-ben

On Dec 30, 2004, at 20.14, Ben Bond-Lamberty wrote:

> I and a few others have seen similar problems.  It happens (as I 
> understand)
> because Darwin (the BSD underlying Mac OS X) follows symlinks with 
> chown
> attempts--try chown'ing a symlink from the command line to see 
> this--which
> is...unintuitive.  So when given the -o or -g (or -a) options, rsync 
> can
> unintentionally end up following links and resetting the permissions 
> on the
> target, not the symlink.
>
> Jonathan Paisley at Glasgow (UK) Computing Science has used the patch 
> below
> in the rsyncX.c source (but should be same for rsync?), preventing it 
> from
> following symlinks in this situation; I have not tried this myself.  
> Hope
> this helps.
>
> Ben
> -----
>
> diff -u -r1.1.1.6 rsync.c
> --- rsync.c     3 Jan 2004 11:22:00 -0000       1.1.1.6
> +++ rsync.c     21 Dec 2004 12:04:56 -0000
> @@ -260,7 +260,7 @@
>                      change to groups that the user is a member of */
>                  change_gid = is_in_group(file->gid);
>          }
> -       if (change_uid || change_gid) {
> +       if (!S_ISLNK(st->st_mode) && (change_uid || change_gid)) {
>                  if (do_lchown(fname,
>                                change_uid?file->uid:st->st_uid,
>                                change_gid?file->gid:st->st_gid) != 0) {
>
>
> On 12/28/04 6:00 AM, btb <btb at bitrate.net> wrote:
>
>> i am using rsync via ssh to maintain a copy of a few directories on a
>> remote server, and am getting an error when rsync tries to chmod a
>> certain file following it's transfer.  there are a couple of cases in
>> which this occurring - below is one example.



More information about the rsync mailing list