Skip to content

external_repo doesn't support symlinks #3348

@gurobokum

Description

@gurobokum

If repo contains symlink during dvc list/get cli commands (external_repo clone) the process crashes

(dvc) jiojiajiu@pon4ik:~/workspace/DVC/dvc$ python -m dvc list test-project -v
2020-02-17 16:15:52,989 DEBUG: Creating external repo test-project@None
2020-02-17 16:15:53,145 ERROR: unexpected error - can't copy '/tmp/tmpt0f2eavwdvc-clone/.travis.yml': doesn't exist or not a regular file
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jiojiajiu/workspace/DVC/dvc/dvc/main.py", line 49, in main
    ret = cmd.run()
  File "/home/jiojiajiu/workspace/DVC/dvc/dvc/command/ls.py", line 40, in run
    with_color=with_color,
  File "/home/jiojiajiu/workspace/DVC/dvc/dvc/repo/ls.py", line 15, in ls
    with external_repo(url, rev) as repo:
  File "/home/jiojiajiu/.pyenv/versions/3.7.6/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/jiojiajiu/workspace/DVC/dvc/dvc/external_repo.py", line 28, in external_repo
    path = _cached_clone(url, rev, for_write=for_write)
  File "/home/jiojiajiu/workspace/DVC/dvc/dvc/external_repo.py", line 198, in _cached_clone
    copy_tree(clone_path, repo_path)
  File "/home/jiojiajiu/.pyenv/versions/3.7.6/lib/python3.7/distutils/dir_util.py", line 163, in copy_tree
    dry_run=dry_run)
  File "/home/jiojiajiu/.pyenv/versions/3.7.6/lib/python3.7/distutils/file_util.py", line 105, in copy_file
    "can't copy '%s': doesn't exist or not a regular file" % src)
distutils.errors.DistutilsFileError: can't copy '/tmp/tmpt0f2eavwdvc-clone/.travis.yml': doesn't exist or not a regular file

Please provide information about your setup

$ dvc --version
0.85.0+57d021.mod

NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?p2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions