[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rdiff-backup-users] [PATCH] Preserve symlink permissions
From: |
Andrew Ferguson |
Subject: |
Re: [rdiff-backup-users] [PATCH] Preserve symlink permissions |
Date: |
Sun, 05 Nov 2006 13:19:56 -0500 |
User-agent: |
Thunderbird 1.5.0.7 (Macintosh/20060909) |
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?
Andrew
--
Andrew Ferguson - address@hidden
diff -Nur rdiff-backup-cvs/rdiff_backup/rpath.py
rdiff-backup-umaskfix/rdiff_backup/rpath.py
--- rdiff-backup-cvs/rdiff_backup/rpath.py 2006-11-04 21:43:10.000000000
-0500
+++ rdiff-backup-umaskfix/rdiff_backup/rpath.py 2006-11-05 13:16:57.000000000
-0500
@@ -103,9 +103,9 @@
elif rpin.issym():
# some systems support permissions for symlinks, but
# only by setting at creation via the umask
- os.umask(0777 - rpin.getperms())
+ orig_umask = os.umask(0777 - rpin.getperms())
rpout.symlink(rpin.readlink())
- os.umask(077) # restore rdiff-backup standard umask
+ os.umask(orig_umask) # restore previous umask
elif rpin.ischardev():
major, minor = rpin.getdevnums()
rpout.makedev("c", major, minor)