Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dvc list: Error on empty directory. #5841

Closed
karajan1001 opened this issue Apr 17, 2021 · 3 comments · Fixed by #6120 or #7729
Closed

dvc list: Error on empty directory. #5841

karajan1001 opened this issue Apr 17, 2021 · 3 comments · Fixed by #6120 or #7729
Assignees
Labels
A: status Related to the dvc diff/list/status bug Did we break something? p2-medium Medium priority, should be done, but less important

Comments

@karajan1001
Copy link
Contributor

karajan1001 commented Apr 17, 2021

Bug Report

Got error message on an empty directory, shouldn't it show nothing? like ls command.

Description

image
Error when list a empty path, strange behavior.
Might relate to

dvc/dvc/repo/ls.py

Lines 40 to 41 in daf0745

if path and not ret:
raise PathMissingError(path, repo, dvc_only=dvc_only)

Reproduce

  1. git init
  2. dvc init
  3. mkdir empty
  4. dvc list . empty

Expected

Show nothing like ls command
image

Environment information

DVC version: 2.0.17+7e4851

Platform: Python 3.8.8 on macOS-10.16-x86_64-i386-64bit
Supports: All remotes
Cache types: https://error.dvc.org/no-dvc-cache
Caches: local
Remotes: None
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git

Output of dvc doctor:

$ dvc doctor

Additional Information (if any):

@karajan1001
Copy link
Contributor Author

We have already had a test about this.

dvc/tests/func/test_ls.py

Lines 167 to 173 in 68897aa

def test_ls_repo_with_path_dir_dvc_only_empty(tmp_dir, dvc, scm):
tmp_dir.scm_gen(FS_STRUCTURE, commit="init")
tmp_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")
tmp_dir.scm_gen({"folder/.keep": "content"}, commit="add .keep")
with pytest.raises(PathMissingError):
Repo.ls(os.fspath(tmp_dir), path="folder", dvc_only=True)

and it was introduced from #3246 at the beginning of dvc list command.

@efiop efiop added bug Did we break something? p2-medium Medium priority, should be done, but less important labels May 11, 2021
@evanrittenhouse
Copy link

@karajan1001 is this still open? New to open source, but would love to take a stab at it

@karajan1001
Copy link
Contributor Author

open

Sorry, we had already had a PR for it (#6120) but was blocked by some refactoring. So maybe it is better to start with some other issues with good first issue.

@daavoo daavoo added the A: status Related to the dvc diff/list/status label Feb 22, 2022
karajan1001 added a commit to karajan1001/dvc that referenced this issue May 5, 2022
@efiop efiop reopened this May 11, 2022
karajan1001 added a commit to karajan1001/dvc that referenced this issue May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: status Related to the dvc diff/list/status bug Did we break something? p2-medium Medium priority, should be done, but less important
Projects
None yet
4 participants