On Sun, 5 Nov 2006, Andrew Ferguson wrote:

> Blair Zajac wrote:
> >> diff -Nur rdiff-backup-cvs/rdiff_backup/rpath.py rdiff-backup- 
> >> symlink-perms/rdiff_backup/rpath.py
> >> --- rdiff-backup-cvs/rdiff_backup/rpath.py 2006-01-13  
> >> 00:29:47.000000000 -0500
> >> +++ rdiff-backup-symlink-perms/rdiff_backup/rpath.py       2006-11-04  
> >> 15:55:39.000000000 -0500
> >> @@ -100,7 +100,12 @@
> >>
> >>    if rpin.isreg(): return copy_reg_file(rpin, rpout, compress)
> >>    elif rpin.isdir(): rpout.mkdir()
> >> -  elif rpin.issym(): rpout.symlink(rpin.readlink())
> >> +  elif rpin.issym():
> >> +          # some systems support permissions for symlinks, but
> >> +          # only by setting at creation via the umask
> >> +          os.umask(0777 - rpin.getperms())
> >> +          rpout.symlink(rpin.readlink())
> >> +          os.umask(077)   # restore rdiff-backup standard umask
> > 
> > I think it would be clearer to do something like this saving the  
> > current result of the umask, so if the umask is changed anywhere  
> > else, it'll always be restored:
> > 
> >             # some systems support permissions for symlinks, but
> >             # only by setting at creation via the umask
> >             orig_umask = os.umask(0777 - rpin.getperms())
> >             rpout.symlink(rpin.readlink())
> >             os.umask(orig_umask)
> 
> Indeed. Thanks, Blair.
> 
> Dean, can you apply the attached patch to CVS?

yeah... i used 0777 & ~rpin.getperms() as well.  in case rpin.getperms() 
returns set[ug]id or sticky.

btw -- adding two syscalls per symlink creation is a bit of a waste for 
platforms where it doesn't matter.  any chance you'd consider adding a 
test to fs_abilities and conditionalizing on it?

-dean


_______________________________________________
rdiff-backup-users mailing list at [email protected]
http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki

Reply via email to