Public bug reported: Binary package hint: coreutils
GNU coreutils cp(1) behaves incorrectly if the user tries to copy a directory recursively. It (rightly) prints an error message, BUT copies the directory anyway, at least one level deep. To demonstrate: | [EMAIL PROTECTED]:~$ uname -a | Linux tranquility 2.6.22-14-386 #1 Sun Oct 14 22:36:54 GMT 2007 i686 GNU/Linux We're using Ubuntu "Gutsy Gibbon" 7.10. | [EMAIL PROTECTED]:~$ mkdir foo | [EMAIL PROTECTED]:~$ touch foo/testfile We're creating a folder containing one file. | [EMAIL PROTECTED]:~$ cp -r foo foo | cp: cannot copy a directory, `foo', into itself, `foo/foo' We're trying to copy that folde into itself. cp(1) prints an error (as it should). However, ls -al (ll) shows that despite the error message, foo and the testfile it contains have nevertheless been copied into foo: | [EMAIL PROTECTED]:~$ ll foo | total 12 | drwxr-xr-x 3 ropers ropers 4096 2007-10-19 22:57 ./ | drwxr-xr-x 85 ropers ropers 4096 2007-10-19 22:56 ../ | drwxr-xr-x 2 ropers ropers 4096 2007-10-19 22:57 foo/ | -rw-r--r-- 1 ropers ropers 0 2007-10-19 22:56 testfile | [EMAIL PROTECTED]:~$ ll foo/foo | total 8 | drwxr-xr-x 2 ropers ropers 4096 2007-10-19 22:57 ./ | drwxr-xr-x 3 ropers ropers 4096 2007-10-19 22:57 ../ | -rw-r--r-- 1 ropers ropers 0 2007-10-19 22:57 testfile | [EMAIL PROTECTED]:~$ This should not happen. When asked to copy a directory recursively, cp(1) should print an error and not perform any copy operation at all. ** Affects: coreutils (Ubuntu) Importance: Undecided Status: New -- incorrect cp(1) behaviour upon "mkdir foo; cp -r foo foo" https://bugs.launchpad.net/bugs/154602 You received this bug notification because you are a member of Ubuntu Bugs, which is the bug contact for Ubuntu. -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs