for child in self.options.filter_listdir(children):
childpath = os.path.join(localpath, child)
child = unicode(child)
- if os.path.isdir(childpath):
+ # note: symlinks to directories are both islink() and isdir()
+ if os.path.isdir(childpath) and not os.path.islink(childpath):
metadata = get_local_metadata(childpath)
# recurse on the child directory
childcap = self.process(childpath)
assert isinstance(childcap, str)
create_contents[child] = ("dirnode", childcap, metadata)
compare_contents[child] = childcap
- elif os.path.isfile(childpath):
+ elif os.path.isfile(childpath) and not os.path.islink(childpath):
try:
childcap, metadata = self.upload(childpath)
assert isinstance(childcap, str)
self.warn("WARNING: permission denied on file %s" % childpath)
else:
self.files_skipped += 1
- self.warn("WARNING: cannot backup special file %s" % childpath)
+ if os.path.islink(childpath):
+ self.warn("WARNING: cannot backup symlink %s" % childpath)
+ else:
+ self.warn("WARNING: cannot backup special file %s" % childpath)
must_create, r = self.check_backupdb_directory(compare_contents)
if must_create:
def _check((rc, out, err)):
self.failUnlessEqual(rc, 2)
- self.failUnlessEqual(err, "WARNING: cannot backup special file %s\n" % os.path.join(source, "foo2.txt"))
+ foo2 = os.path.join(source, "foo2.txt")
+ self.failUnlessEqual(err, "WARNING: cannot backup symlink %s\n" % foo2)
fu, fr, fs, dc, dr, ds = self.count_output(out)
# foo.txt