dvc
dvc copied to clipboard
Add: give βdoes not exist ERRORβ if a file with a leading question mark is given
Bug Report
Description
see Issue name.
Reproduce
I have a dvc folder data with has two files test?test.txt and ?test.txt:
.
βββ data
βββ test?test.txt
βββ ?test.txt
1 directory, 3 files
If I try to add ?test.txt I get this error:
$ dvc add data/\?test.txt
Adding...
ERROR: output 'data?test.txt' does not exist
Apparently DVC things I want to add data?test.txt and yes this file does not exist, but this is not what I wanna add. The other file data/test?test.txt I can add without any problems. I thing there is a problem with the leading question mark. I also tested this witch a leading β#β, same problem.
My question is: Is this on purpose? I noticed the behavior in DVC version 2.18.1 or so. Befor I hat no problem with leading question marks.
Expected
Just add the file.
Environment information
DVC version: 2.20.0 (deb)
---------------------------------
Platform: Python 3.8.3 on Linux-5.4.0-125-generic-x86_64-with-glibc2.14
Supports:
http (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
https (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
ssh (sshfs = 2022.6.0)
Cache types: hardlink, symlink
Cache directory: ext4 on /dev/sda2
Caches: local
Remotes: None
Workspace directory: ext4 on /dev/sda2
Repo: dvc, git
Additional Information (if any):
Hi, @samuelkees .
Sorry I can not reproduce it.
$ dvc add data/?ext.txt -127-[ins][18:43:11]
100% Adding...|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|1/1 [00:00, 68.11file/s]
To track the changes with git, run:
git add data/.gitignore data/text.txt.dvc
To enable auto staging, run:
dvc config core.autostage true
$ dvc add data?text.txt [ins][18:43:21]
100% Adding...|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|1/1 [00:00, 124.39file/s]
To track the changes with git, run:
git add .gitignore data_text.txt.dvc
To enable auto staging, run:
dvc config core.autostage true
$ tree
.
βββ data
βΒ Β βββ text.txt
βΒ Β βββ text.txt.dvc
βββ data_text.txt
βββ data_text.txt.dvc
1 directory, 4 files
And If I remember correctly that this wild match was done by the shell instead of DVC, for example
$ cat data/?ext.txt
show a correct result on my zsh.
I use Bash and cat is working
$ cat data/\?test.txt
testtesttesttest
testtesttesttest
testtesttesttest
? is part of the name...
cat data/?????.txt
testtesttesttest
testtesttesttest
testtesttesttest
? is used as wildcard character...
Maybe I miss communicated. The name of the file starts with a ?. I donβt use ? as a wildcard character or something. You can see this in my first cat command the ? is escaped \?. If I understand you example correctly, your file has the name data/text.txt but my file name is data/?test.txt (again the ? is part of the name). Can you try your example with a file named ?text.txt ?
@samuelkees Can you try running the command but wrapping the argument with quotes 'data/?test.txt'?
@daavoo i did its as well, same behavior for me.
dvc add 'data/?test.txt'
Adding...
ERROR: output 'data?test.txt' does not exist
I tested it with DVC version 2.18.0; all cool. DVC version 2.18.1 i get the same error.
$ tree
.
`-- data
`-- ?test.txt
1 directory, 1 file
$ dvc --version
2.18.0
$ dvc add data/\?test.txt
WARNING: 'data/?test.txt' is empty.
100% Adding...|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ|1/1 [00:00, 24.07file/s]
To track the changes with git, run:
git add data/.gitignore 'data/?test.txt.dvc'
To enable auto staging, run:
dvc config core.autostage true
This was introduced in https://github.com/iterative/dvc-objects/commit/23e87bb76bca81fd88053f8fadf628d975f94a12 cc @efiop
I think this was closed by https://github.com/iterative/dvc-objects/pull/179
Confirmed is fixed on latest release