dvc icon indicating copy to clipboard operation
dvc copied to clipboard

Add: give β€˜does not exist ERROR’ if a file with a leading question mark is given

Open samuelkees opened this issue 3 years ago β€’ 6 comments
trafficstars

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):

samuelkees avatar Aug 25 '22 09:08 samuelkees

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.

karajan1001 avatar Aug 25 '22 10:08 karajan1001

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 avatar Aug 25 '22 12:08 samuelkees

@samuelkees Can you try running the command but wrapping the argument with quotes 'data/?test.txt'?

daavoo avatar Aug 25 '22 12:08 daavoo

@daavoo i did its as well, same behavior for me.

dvc add 'data/?test.txt' 
Adding...                                                                                                            
ERROR: output 'data?test.txt' does not exist

samuelkees avatar Aug 25 '22 13:08 samuelkees

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

samuelkees avatar Aug 29 '22 13:08 samuelkees

This was introduced in https://github.com/iterative/dvc-objects/commit/23e87bb76bca81fd88053f8fadf628d975f94a12 cc @efiop

daavoo avatar Aug 29 '22 14:08 daavoo

I think this was closed by https://github.com/iterative/dvc-objects/pull/179

daavoo avatar Jan 17 '23 10:01 daavoo

Confirmed is fixed on latest release

daavoo avatar Jan 17 '23 10:01 daavoo