Re: design question, why not always use 'cp --remove-destination'?
From:
Frederik Eaton
Subject:
Re: design question, why not always use 'cp --remove-destination'?
Date:
Wed, 23 Aug 2006 01:57:23 +0100
User-agent:
mutt-ng/devel-r472 (Debian)
Thanks to everyone for the answers.
Frederik
On Tue, Aug 22, 2006 at 12:29:24PM -0700, Paul Eggert wrote:
> Frederik Eaton <address@hidden> writes:
>
> > is there a reason why users wouldn't always want a "copyFile"
> > function to remove the destination first?
>
> Lots and lots and lots of reasons. For example, the destination file
> might be read-only, and the user might want the copy to fail in that
> case. A copyFile that first removed the destination would mistakenly
> succeed on a read-only destination.
>
> Another example: "cp infile /dev/null". Replacing /dev/null with a
> regular file is a bad idea, in my experience. (And I have experience. :-)
>
> This may help to explain why Unix does not have a standard copy_file
> function. Copying a file is harder than it looks, and there are lots
> of options. Good luck with your attempt to simplify things for Haskell.
>
--
http://ofb.net/~frederik/