On Tue, Nov 18, 2014 at 03:49:36PM -0500, Wolfgang Corcoran-Mathe wrote:
> Quoth FRIGN on Tue, Nov 18 2014 19:30 +0100:
> >Well, install doesn't do any magic.
> 
> There is this.[1] But if the issue is unlinking a running target,
> (a) how often is this an issue, considering one will often be make
> install-ing to a package directory, and (b) isn't this what
> POSIX cp -f is for?

Regarding your question on cp -f then the answer is not quite.

cp -f will try to unlink the destination if it fails to open it for whatever
reason.

The relevant text from POSIX:

"-f
    If a file descriptor for a destination file cannot be obtained, as
described in step 3.a.ii., attempt to unlink the destination file and proceed."

You can try this locally as:

touch a b
strace cp -f a b &> log
grep unlink log

versus

touch a b
chmod 0 b
strace cp -f a b &> log
grep unlink log

Initially I thought the sbase cp -f implementation was incorrect but apparently
it is not.

Reply via email to