Re: [dev] why avoid install?

From: Dimitris Papastamos <sin_AT_2f30.org>
Date: Wed, 19 Nov 2014 14:55:25 +0000

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.
Received on Wed Nov 19 2014 - 15:55:25 CET

This archive was generated by hypermail 2.3.0 : Wed Nov 19 2014 - 16:00:10 CET