Skip to content

shutil.copytree between 2 overlayed directories fails #7

@verterok

Description

@verterok

When writing a test for a funcion that uses shtuil.copytree, found this error:

Traceback (most recent call last):
  File "repro-bug.py", line 15, in <module>
    shutil.copytree('/src', '/dest')
  File "/home/guillermo/canonical/charms/ols/layers/ols-layers/env/lib/python3.5/shutil.py", line 347, in copytree
    copystat(src, dst)
  File "/home/guillermo/canonical/charms/ols/layers/ols-layers/env/lib/python3.5/shutil.py", line 195, in copystat
    follow_symlinks=follow)
  File "/home/guillermo/canonical/charms/ols/layers/ols-layers/env/lib/python3.5/site-packages/systemfixtures/_overlay.py", line 24, in _new_value
    return self.overlay(self._old_value, *args, **kwargs)
  File "/home/guillermo/canonical/charms/ols/layers/ols-layers/env/lib/python3.5/site-packages/systemfixtures/filesystem.py", line 125, in _generic
    return real(self._real_path(path), *args, **kwargs)
TypeError: unsupported operand type(s) for divmod(): 'NoneType' and 'int'

Here is the simplest script I could get to reproduce it:


import shutil
import tempfile
import systemfixtures

# create root temp dir
tmpdir = tempfile.mkdtemp()

fs = systemfixtures.FakeFilesystem()
fs.setUp()
fs.add('/src')
fs.add('/dest')

shutil.copytree(tmpdir, '/src')
shutil.copytree('/src', '/dest')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions