mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
'tahoe cp -r', upon encountering a dangling symlink, would assert out.
This was somewhat sad; the assertion didn't say what path caused the error, what went wrong. So... silently skip over things that are neither dirs nor files.
This commit is contained in:
parent
83b97ee79f
commit
3267984fa9
@ -117,9 +117,11 @@ class LocalDirectorySource:
|
||||
self.children[n] = child
|
||||
if recurse:
|
||||
child.populate(True)
|
||||
else:
|
||||
assert os.path.isfile(pn)
|
||||
elif os.path.isfile(pn):
|
||||
self.children[n] = LocalFileSource(pn)
|
||||
else:
|
||||
# Could be dangling symlink; probably not copy-able.
|
||||
pass
|
||||
|
||||
class LocalDirectoryTarget:
|
||||
def __init__(self, progressfunc, pathname):
|
||||
|
@ -600,3 +600,18 @@ class Cp(SystemTestMixin, CLITestMixin, unittest.TestCase):
|
||||
|
||||
return d
|
||||
test_unicode_filename.todo = "This behavior is not yet supported, although it does happen to work (for reasons that are ill-understood) on many platforms. See issue ticket #534."
|
||||
|
||||
def test_dangling_symlink_vs_recursion(self):
|
||||
# cp -r on a directory containing a dangling symlink shouldn't assert
|
||||
self.basedir = os.path.dirname(self.mktemp())
|
||||
dn = os.path.join(self.basedir, "dir")
|
||||
os.mkdir(dn)
|
||||
fn = os.path.join(dn, "Fakebandica")
|
||||
ln = os.path.join(dn, "link")
|
||||
os.symlink(fn, ln)
|
||||
|
||||
d = self.set_up_nodes()
|
||||
d.addCallback(lambda res: self.do_cli("create-alias", "tahoe"))
|
||||
d.addCallback(lambda res: self.do_cli("cp", "--recursive",
|
||||
dn, "tahoe:"))
|
||||
return d
|
||||
|
Loading…
x
Reference in New Issue
Block a user