Paul Eggert <[EMAIL PROTECTED]> wrote:
> Jim Meyering <[EMAIL PROTECTED]> writes:
>
>>   $ mkdir a b c
>>   $ touch {a,b}/important.h
>>   $ cp a/*.h b/*.h c
>>   cp: will not overwrite just-created `c/important.h' with `b/important.h'
>
> Hmm, does POSIX allow this behavior?  I just visited
> <http://www.opengroup.org/onlinepubs/000095399/utilities/cp.html> and
> it gives a pretty-specific algorithm that requires "cp A B D/." to be
> equivalent to "cp A D/.; cp B D/.".
>
> Similarly for "mv".
>
> I assume that behavior is in there because somebody got burned one
> day, and it seems like a nice feature to have.  But if it doesn't
> conform to POSIX, we need to either fix POSIX or change the code
> somehow.

Right.  My motivation for adding this `feature' was to prevent
`mv a/* b/* dir' from destroying (silently!) user data.  By the
same token, a successful invocation of `cp a/* b/* dir' might well
be followed by rm -rf a b.

It's be nice to fix POSIX.

Here's the NEWS item from fileutils-4.1.1 (November 3, 2001):

  * mv (likewise for cp), now fails rather than silently clobbering one of
      the source files in the following example:
      rm -rf a b c; mkdir a b c; touch a/f b/f; mv a/f b/f c


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to