cp: preserved hardlinks are not reported in --verbose
BenWiederhake opened this issue · comments
This probably affects other types/modes of copying, too, since we have a lot of shurt-cutting currently.
Steps to reproduce:
- Have two files that are hardlinks
- Copy them with
-dv
to some other directory
Expected behavior: Both files are copied, the resulting two files are hardlinks of each other but not of the original files, and both copy operations are reported.
Actual behavior: Both files are copied, the resulting two files are hardlinks of each other but not of the original files, but only one copy operation is reported.
Demonstrator:
$ ln README.md README.md.hd
$ rm -f target/README.md* && ../gnu/src/cp -dv README.md README.md.hd target/ && ls -i README.md README.md.hd target/README.md target/README.md.hd
'README.md' -> 'target/README.md'
'README.md.hd' -> 'target/README.md.hd'
20093851 README.md 20093851 README.md.hd 20928436 target/README.md 20928436 target/README.md.hd
$ rm -f target/README.md* && cargo run cp -dv README.md README.md.hd target/ && ls -i README.md README.md.hd target/README.md target/README.md.hd
'README.md' -> 'target/README.md'
20093851 README.md 20093851 README.md.hd 20928436 target/README.md 20928436 target/README.md.hd
$
(In this example, the copied files "randomly" got the same inode ID twice in a row, but they might have gotten a different ID in the second run.)
Found while reviewing #6208