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

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

[PATCH] Re: symlink fs_abilities (was Re: [rdiff-backup-users] [PATCH] L


From: Gordon Rowell
Subject: [PATCH] Re: symlink fs_abilities (was Re: [rdiff-backup-users] [PATCH] Log symlink creation)
Date: Mon, 20 Nov 2006 18:13:14 +1100
User-agent: Mozilla Thunderbird 1.0.8-1.4.1.centos4 (X11/20060421)

Gordon Rowell wrote:

[...]
So, for cleanliness we should add symlinks as a capability in fs_abilities so that we don't throw/log the error on filesystems which do not support symlinks. I'll have a look at that.


I believe this covers the first part - detecting whether the filesystem
supports symlinks. Works for me on Linux/ext3fs and Windows/CIFS
targets. OSError is still thrown when an attempt is made to actually
create a symlink on a filesystem which doesn't support such - to follow.

Thanks,

Gordon

diff -Nur -x '*.orig' -x '*.rej' 
rdiff-backup-1.1.7/rdiff_backup/fs_abilities.py 
mezzanine_patched_rdiff-backup-1.1.7/rdiff_backup/fs_abilities.py
--- rdiff-backup-1.1.7/rdiff_backup/fs_abilities.py     2006-11-12 
20:08:42.000000000 -0700
+++ mezzanine_patched_rdiff-backup-1.1.7/rdiff_backup/fs_abilities.py   
2006-11-20 00:01:59.000000000 -0700
@@ -39,6 +39,7 @@
        acls = None # True if access control lists supported
        eas = None # True if extended attributes supported
        hardlinks = None # True if hard linking supported
+       symlinks = None # True if symbolic linking supported
        fsync_dirs = None # True if directories can be fsync'd
        dir_inc_perms = None # True if regular files can have full permissions
        resource_forks = None # True if system supports resource forks
@@ -83,6 +84,7 @@
                if not self.read_only:
                        add_boolean_list([('Ownership changing', 
self.ownership),
                                                          ('Hard linking', 
self.hardlinks),
+                                                         ('Symbolic linking', 
self.symlinks),
                                                          ('fsync() 
directories', self.fsync_dirs),
                                                          ('Directory inc 
permissions',
                                                           self.dir_inc_perms),
@@ -138,6 +140,7 @@
                self.set_case_sensitive_readwrite(subdir)
                self.set_ownership(subdir)
                self.set_hardlinks(subdir)
+               self.set_symlinks(subdir)
                self.set_fsync_dirs(subdir)
                self.set_eas(subdir, 1)
                self.set_acls(subdir)
@@ -178,6 +181,19 @@
                        self.hardlinks = 0
                else: self.hardlinks = 1
 
+        def set_symlinks(self, testdir):
+                """Set self.symlinks to true iff symbolic links can be made"""
+                sl_target = testdir.append("symlink_target")
+                sl_target.touch();
+                sl_source = testdir.append("symlink_source")
+                try:
+                        sl_source.symlink(sl_target.path)
+                except (IOError, OSError):
+                        log.Log("Warning: symbolic links not supported by 
filesystem "
+                                        "at %s" % (self.root_rp.path,), 3)
+                        self.symlinks = 0
+                else: self.symlinks = 1
+
        def set_fsync_dirs(self, testdir):
                """Set self.fsync_dirs if directories can be fsync'd"""
                assert testdir.conn is Globals.local_connection


reply via email to

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