Open meowcat opened 2 years ago
@skshetry @efiop In the dvc add -R dvcfiles
scenario, I'm not understanding why DVC doesn't preserve isexec
since each individual file has its own .dvc
file. In the case of adding the entire directory with dvc add dvcfiles
, it might be trickier since there's no way currently to save the isexec
info. WDYT?
It seems like it would also be nice to preserve the executable flag at the group/other levels, but let's leave that for a separate issue.
I can reproduce it on the latest DVC version.
It looks like this is a regression introduced in #7313.
Prior to that change, after running the script above, I get:
$ ll dvc-reprex/dvcfiles
total 40
drwxr-xr-x 7 dave wheel 224 May 3 20:12 .
drwxr-xr-x 6 dave wheel 192 May 3 20:12 ..
-rw-r--r-- 1 dave wheel 8 May 3 20:12 .gitignore
-rwxr--r-- 1 dave wheel 4 May 3 20:12 f1
-rw-r--r-- 1 dave wheel 82 May 3 20:12 f1.dvc
-rwxr--r-- 1 dave wheel 4 May 3 20:12 f2
-rw-r--r-- 1 dave wheel 82 May 3 20:12 f2.dvc
Running the same script after that change, I get:
$ ll dvc-reprex/dvcfiles
total 40
drwxr-xr-x 7 dave wheel 224 May 3 20:12 .
drwxr-xr-x 6 dave wheel 192 May 3 20:12 ..
-rw-r--r-- 1 dave wheel 8 May 3 20:12 .gitignore
-rw-r--r-- 1 dave wheel 4 May 3 20:12 f1
-rw-r--r-- 1 dave wheel 67 May 3 20:12 f1.dvc
-rw-r--r-- 1 dave wheel 4 May 3 20:12 f2
-rw-r--r-- 1 dave wheel 67 May 3 20:12 f2.dvc
cc @efiop
I'm curious how we handle this kind of metadata for now. An example is the tar
in Unix
which is good at handling Unix permissions, hard links, softlinks, different times associated with files. To achieve this, it stores this metadata as a header to the original file.
Bug Report
Description
With
cache.type = copy
, executingdvc add -R
twice clears the executable flags from the added files. The first time,isexec
is correctly added to the corresponding.dvc
file; the second time, the files lose their executable flag andisexec
is removed from the.dvc
file.Reproduce
Expected
One of two things:
dvc add
Environment information
Debian 11, both btrfs and ext4
Output of
dvc doctor
:Additional Information (if any):
dvc add -R
. Note that when adding the entire directory (not using-R
), the exec flag is cleared on the first `dvc add!