coreutils
coreutils copied to clipboard
cp-parents.sh: cp: recursive copy
ref: #3320
Below described issue is at least one of the reason why the gnu test tests/cp/cp-parents.sh is in ERROR state.
gnu
> cp --verbose -a --parents a/b/c d
a -> d/a
a/b -> d/a/b
'a/b/c' -> 'd/a/b/c'
uutils
> cp --verbose -a --parents a/b/c d
> ls -al d
total 0
drwxr-xr-x 3 bha_srik_k users 15 Mar 29 12:51 .
drwxr-xr-x 12 bha_srik_k users 178 Mar 29 12:48 ..
drwxr-xr-x 2 bha_srik_k users 6 Mar 29 12:51 c
- note that gnu creates the directory
d/a/b/cwhereas uutils creates the directoryd/c - also, the verbose options seems to be not working in uutils
Note: The directories a/b/c and d must all exist before running those test cases
Note: The directories
a/b/canddmust all exist before running those test cases
No. They get created.
Hmm, with cp v 8.30, I see the following behavior.
If d does not exist:
$ cp --verbose -a --parents a/b/c d
cp: with --parents, the destination must be a directory
Try 'cp --help' for more information.
If d does exist but a/b/c does not exist:
$ cp --verbose -a --parents a/b/c d
cp: failed to get attributes of 'a': No such file or directory
If both a/b/c and d exist:
$ cp --verbose -a --parents a/b/c d
a -> d/a
a/b -> d/a/b
'a/b/c' -> 'd/a/b/c'
Do you see something different from that?
@DevSabb what do you think?
@jfinkels yes. I see similar behavior.
I've checked now and it seems that uutils has the same behavior as GNU, but --verbose messages are not full. It prints the last file copied, but doesn't print anything for directories created. Seems like a good first issue from my point of view.
I also added test above and the same one with the symlink as the directory in PR #3721
I've checked now and it seems that uutils has the same behavior as GNU, but
--verbosemessages are not full.
I don't see this. I still see the error (and also the verbose messages are absent).
$ mkdir -p a/b/c d
$ ./target/debug/cp -a --verbose --parents a/b/c d
$ ls -l d
total 4
drwxrwxr-x 2 jeffrey jeffrey 4096 Sep 1 20:31 c
Do you see something different from that?
I see the same.
It seems that I didn't look at the cp-parents.sh file then. What I tested was:
$ mkdir -p a/b d
$ touch a/b/c
$ ./target/debug/cp -a --verbose --parents a/b/c d
'a/b/c' -> 'd/a/b/c'
$ find d
d
d/a
d/a/b
d/a/b/c
Ah, I see. There are different code paths if c is a file or if c is a directory.
The pull request #4071 resolved the issue
note that gnu creates the directory d/a/b/c whereas uutils creates the directory d/c
but it did not resolve the issue
also, the verbose options seems to be not working in uutils
so let's keep this open? Could also open a new issue if people prefer.