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

Incorrect error message when importing to non-existent folder #3338

Closed
charlesbaynham opened this issue Feb 15, 2020 · 3 comments · Fixed by #3509
Closed

Incorrect error message when importing to non-existent folder #3338

charlesbaynham opened this issue Feb 15, 2020 · 3 comments · Fixed by #3509
Assignees
Labels
bug Did we break something? p1-important Important, aka current backlog of things to do

Comments

@charlesbaynham
Copy link
Contributor

charlesbaynham commented Feb 15, 2020

Setup

dvc 0.84.0
Mac, installation via conda

Problem

When importing a file from a git repo into a subdirectory in the current repo, dvc fails with an incorrect error message if the subdirectory does not exist.

To demonstrate this problem, run the following:

## Setup a git repo to import from
mkdir source_repo
cd source_repo
git init
echo Some code > code.txt
git add .
git commit -m "Save some code to this demo repo"

## setup a DVC repo to import from the previous
cd -
mkdir import_repo
cd import_repo
git init
dvc init
git add .
git commit -m "This is a dvc repo that will import some code"

echo --------------------------
echo The next command will fail with an incorrect error message
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

## Attempt an import which will fail
# This command will fail:
dvc import -o some_dir/code.txt ../source_repo code.txt

mkdir some_dir

echo --------------------------
echo Now we have made the output directory, it will succeed
echo --------------------------
read -rsp $'Press any key to continue...\n' -n1 key

dvc import -o some_dir/code.txt ../source_repo code.txt

Expected behavior

Error message stating that the output directory does not exist

Actual behaviour

This error message:

ERROR: failed to import 'code.txt' from '../source_repo'. - The path 'code.txt' does not exist in the target repository '../source_repo' neither as an output nor a git-handled file.

Note that code.txt does exist and is committed to git. DVC successfully imports it if the subdirectory some_dir exists.

@triage-new-issues triage-new-issues bot added the triage Needs to be triaged label Feb 15, 2020
@charlesbaynham charlesbaynham changed the title Incorrect error message when importing to non-existant folder Incorrect error message when importing to non-existent folder Feb 15, 2020
@efiop efiop added bug Did we break something? p0-critical Critical issue. Needs to be fixed ASAP. labels Feb 15, 2020
@triage-new-issues triage-new-issues bot removed the triage Needs to be triaged label Feb 15, 2020
@efiop efiop added the research label Feb 15, 2020
@efiop
Copy link
Contributor

efiop commented Feb 15, 2020

Hi @charlesbaynham ! Thanks for reporting this issue! I am able to reproduce a similar issue with:

dvc import https://github.com/iterative/dvc scripts/innosetup/dvc.ico -o nonexistent_dir/dvc.ico

But dvc get seems to work fine with the same arguments, so some of our logic has diverged there.
Looking into it...

@efiop
Copy link
Contributor

efiop commented Feb 16, 2020

@charlesbaynham We've done some adjustments to import logic and now I'm getting a different error from your script:

+ dvc import -o some_dir/code.txt ../source_repo code.txt                                                                                              
ERROR: failed to import 'code.txt' from '../source_repo'. - stage working or file path '/home/efiop/git/dvc/myrepo/import_repo/some_dir' does not exist

which has a typo (will send a fix soon), but is now pointing out that the directory doesn't, which is expected behaviour now.

@efiop efiop added p1-important Important, aka current backlog of things to do and removed p0-critical Critical issue. Needs to be fixed ASAP. labels Feb 16, 2020
@charlesbaynham
Copy link
Contributor Author

Thank you @efiop ! DVC is great by the way, I'm enjoying using it a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Did we break something? p1-important Important, aka current backlog of things to do
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants