Public bug reported:

One behavior of the GNU implementation of `cp` is that it will copy the
contents of a directory, rather than the directory itself, if a trailing
dot slash is appended to the directory name like:

```
# This should copy the contents of d, not d itself, to d2
$ cp -r d/./ d2

The rust-coreutils `cp` does not have this behavior and thus introduces
a regression. This can be verified with the minimal reproducer:

$ mkdir test test2
$ echo a > test/file.txt

# rust-coreutils
$ cp -r test/./ test2
$ ls test2
test

# GNU
$ gnucp -r test/./ test2
$ ls test2
file.txt

# Omitting the trailing slash has the correct behavior for rust-coreutils
$ cp -r test/. test2
$ ls test2
file.txt
```

The bug was discovered in this comment on GitHub:
https://github.com/teemtee/tmt/issues/5144#issuecomment-5677474729

** Affects: rust-coreutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167447

Title:
  cp -r with trailing dot slash copies directory instead of contents

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2167447/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to