[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: question for cp tools
From: |
Jim Meyering |
Subject: |
Re: question for cp tools |
Date: |
Fri, 04 Mar 2005 09:59:58 +0100 |
Paul Eggert <address@hidden> wrote:
> Jim Meyering <address@hidden> 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
- question for cp tools, 정병훈, 2005/03/02
- Re: question for cp tools, Jim Meyering, 2005/03/03
- Re: question for cp tools, Bob Proulx, 2005/03/04
- Re: question for cp tools, Jim Meyering, 2005/03/05
- Re: question for cp tools, Bob Proulx, 2005/03/05
- Re: question for cp tools, Jim Meyering, 2005/03/06