rdiff-backup-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [rdiff-backup-users] rdiff backup . mac os x/hfs . icons/finder labe


From: Andrew Ferguson
Subject: Re: [rdiff-backup-users] rdiff backup . mac os x/hfs . icons/finder labels
Date: Wed, 16 Aug 2006 18:05:12 -0400
User-agent: Thunderbird 1.5.0.5 (Macintosh/20060719)

Hi Frank,

You have hit an unfortunate bug in the way Mac OS X and rdiff-backup
interact regarding Extended Attributes. Fortunately, there are two ways
to fix this problem.

The first way is to turn off extended attributes support in rdiff-backup
by removing the xattr python module. Then, resource forks and finder
information (which contain the custom icons and color-labels) will be
properly backed-up and restored.

The second way is to run the CVS version of rdiff-backup and apply my
attached patch for this problem. I submitted it in April, but
unfortunately it hasn't made it into CVS yet. My original e-mail about
the patch can be found here:
http://lists.nongnu.org/archive/html/rdiff-backup-users/2006-04/msg00032.html

Note: the current implementation of extended attributes support in
rdiff-backup (without my patch) is actually broken on Mac OS X. Even if
you are using the xattr python module, it isn't actually doing anything
except preventing resource forks and Finder information from being
backed-up and restored.

So, long story short, both options will cure your dataloss and the xattr
module (which isn't doing you any good) is causing the problem.

Andrew


Frank Hellenkamp wrote:
> hi all,
> 
> until now, i am using rsync for backup on my mac os x tiger system. but
> i think, rdiff-backup could be a much better solution, so i tried it.
> i found some entries in this mailing-list and the rdiff-backup wiki
> regarding hfs and extended attributes, which should work so far.
> 
> i tried different backups (hfs -> hfs; hfs -> etx3 on linux). but in
> every case some things are lost, which are custom file- and folder-icons
> and custom color-labels. there *is* an "icon"-file in the backup, which
> is restored, but empty and not attached to any file or folder.
> 
> i don't know, how these are saved (first i thought it would be in
> resource forks), and if these are accessible by the py-xattr-module.
> 
> spotlight-comments *are* preserved for example.
> 
> i tried this with "--carbonfile" and "--no-carbonfile".
> 
> any ideas?
> 
> btw:
> i tried this with rdiff-backup version 1.0.4 and 1.1.5, both installed
> by darwinports.
> 
> 
> 
> 
> -------------------
> 
> address@hidden jonas $ rdiff-backup -v 4 Desktop Desktop_backup
> Unable to import module posix1e from pylibacl package.
> ACLs not supported on filesystem at Desktop
> ------------------------------
> Detected abilities for source (read only) file system:
> Access control lists Off
> Extended attributes On
> Mac OS X style resource forks On
> Mac OS X Finder information On
> ------------------------------
> Unable to import module posix1e from pylibacl package.
> ACLs not supported on filesystem at
> Desktop_backup/rdiff-backup-data/rdiff-backup.tmp.0
> ------------------------------
> Detected abilities for destination (read/write) file system:
> Characters needing quoting '^a-z0-9_ -.'
> Ownership changing Off
> Hard linking On
> fsync() directories On
> Directory inc permissions On
> High-bit permissions On
> Access control lists Off
> Extended attributes On
> Mac OS X style resource forks On
> Mac OS X Finder information On
> ------------------------------
> Starting mirror Desktop to Desktop_backup
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rdiff-backup-users mailing list at address@hidden
> http://lists.nongnu.org/mailman/listinfo/rdiff-backup-users
> Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki

-- 
Andrew Ferguson - address@hidden

diff -Nur rdiff-backup-CVS/rdiff_backup/eas_acls.py 
rdiff-backup-LOCAL/rdiff_backup/eas_acls.py
--- rdiff-backup-CVS/rdiff_backup/eas_acls.py   2005-12-11 20:15:22.000000000 
-0500
+++ rdiff-backup-LOCAL/rdiff_backup/eas_acls.py 2006-04-29 16:01:21.000000000 
-0400
@@ -64,8 +64,11 @@
                                return
                        raise
                for attr in attr_list:
-                       if not attr.startswith('user.'):
-                               # Only preserve user extended attributes
+                       if attr.startswith('system.'):
+                               # Do not preserve system extended attributes
+                               continue
+                       if attr == 'com.apple.FinderInfo' or attr == 
'com.apple.ResourceFork':
+                               # FinderInfo and Resource Fork handled elsewhere
                                continue
                        try: self.attr_dict[attr] = 
rp.conn.xattr.getxattr(rp.path, attr)
                        except IOError, exc:
@@ -92,7 +95,14 @@
                """Write extended attributes to rpath rp"""
                self.clear_rp(rp)
                for (name, value) in self.attr_dict.iteritems():
-                       rp.conn.xattr.setxattr(rp.path, name, value)
+                       try:
+                               rp.conn.xattr.setxattr(rp.path, name, value)
+                       except IOError, exc:
+                               # Mac and Linux attributes have different 
namespaces, so
+                               # fail gracefully if can't call setxattr
+                               if exc[0] == errno.EOPNOTSUPP or exc[0] == 
errno.EACCES:
+                                       continue
+                               else: raise
 
        def get(self, name):
                """Return attribute attached to given name"""
diff -Nur rdiff-backup-CVS/rdiff_backup/rpath.py 
rdiff-backup-LOCAL/rdiff_backup/rpath.py
--- rdiff-backup-CVS/rdiff_backup/rpath.py      2006-01-13 00:29:47.000000000 
-0500
+++ rdiff-backup-LOCAL/rdiff_backup/rpath.py    2006-04-29 15:57:30.000000000 
-0400
@@ -160,13 +160,13 @@
        if Globals.change_ownership:
                rpout.chown(*rpout.conn.user_group.map_rpath(rpin))
        if rpin.issym(): return # symlinks don't have times or perms
+       if Globals.eas_write: rpout.write_ea(rpin.get_ea())
        if (Globals.resource_forks_write and rpin.isreg() and
                rpin.has_resource_fork()):
                rpout.write_resource_fork(rpin.get_resource_fork())
        if (Globals.carbonfile_write and rpin.isreg() and
                rpin.has_carbonfile()):
                rpout.write_carbonfile(rpin.get_carbonfile())
-       if Globals.eas_write: rpout.write_ea(rpin.get_ea())
        rpout.chmod(rpin.getperms())
        if Globals.acls_write: rpout.write_acl(rpin.get_acl())
        if not rpin.isdev(): rpout.setmtime(rpin.getmtime())
@@ -183,13 +183,13 @@
        check_for_files(rpin, rpout)
        if Globals.change_ownership: apply(rpout.chown, rpin.getuidgid())
        if rpin.issym(): return # symlinks don't have times or perms
+       if Globals.eas_write: rpout.write_ea(rpin.get_ea())
        if (Globals.resource_forks_write and rpin.isreg() and
                rpin.has_resource_fork() and rpout.isreg()):
                rpout.write_resource_fork(rpin.get_resource_fork())
        if (Globals.carbonfile_write and rpin.isreg() and
                rpin.has_carbonfile() and rpout.isreg()):
                rpout.write_carbonfile(rpin.get_carbonfile())
-       if Globals.eas_write: rpout.write_ea(rpin.get_ea())
        if rpin.isdir() and not rpout.isdir():
                rpout.chmod(rpin.getperms() & 0777)
        else: rpout.chmod(rpin.getperms())

reply via email to

[Prev in Thread] Current Thread [Next in Thread]