design question, why not always use 'cp --remove-destination'?
frederik at a5.repetae.net
Tue Aug 22 10:12:19 EDT 2006
We are trying to decide what the semantics of the Haskell standard
library function 'copyFile' should be. The first incarnation behaved
roughly like 'cp', i.e. overwriting destination files without
unlinking them first. This isn't suitable for installing stuff, for
example, since if an executable is running and we try to overwrite it
then there is a "Text file busy" error. We could change the semantics
to be the same as 'cp --remove-destination', i.e. unlinking
pre-existing destination files.
The question is, is there a reason why users wouldn't always want a
"copyFile" function to remove the destination first? If there is, then
maybe we should have two separate functions, for both situations. The
only drawback I can think of for removing the destination first, is a
race condition when someone else is trying to create the same file,
but how often does that actually become a problem?
More information about the Libraries