help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .DELETE_ON_ERROR


From: Christof Warlich
Subject: Re: .DELETE_ON_ERROR
Date: Sat, 03 Dec 2011 12:09:25 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Thunderbird/3.1.15

Am 02.12.2011 21:37, schrieb Paul Smith:
On Fri, 2011-12-02 at 16:51 +0100, Warlich, Christof wrote:
To me, not deleting directories in this scenario looks like a flaw. Do
you agree? Is it going to be fixed?
I don't really agree, no.  At the very most, it might be possible to
delete a directory if it's empty.  I don't think it would be a good idea
to delete a non-empty directory if the rule fails; that could be
disastrous.
I don't see much of a difference in quality compared to ordinary files:
Deleting a single file could be as disastrous as an entire directory.

Further, consider that deletion may only happen if:

a) the writer of the makefile has made the directory a target, i.e. a
generated object, so its content must have been generated too
b) the writer of that makefile has explicitly requested to delete targets
if something goes wrong during their creation by adding the
.DELETE_ON_ERROR target

On the other hand, not deleting the directory in case of an error
leaves the target in a broken state, while Make thinks it is fine and
up to date. This is not was is typically intended.

Am I right when guessing that your reasoning behind not deleting
directories in such a scenario is to prevent users that either wrote
an erroneous makefile or have put a makefile into an erroneous
location, from deleting valuable data when calling Make? While this
would still only be a matter of quantity, not quality, this would be
something I could understand, even though this safety comes at
the considerable price to risk inconsistent targets.

But maybe we can work out a solution that satisfies both the safety
demand when misusing Make and the need to create either a consistent
or no target:

a) My first idea is to evaluate prerequisites for the .DELETE_ON_ERROR
target, and only deleting a directory (including its conent) when
it was explicitly listed as prerequisite to .DELETE_ON_ERROR.
This would force the writer of the makefile to clearly state that a
particular directory should really be deleted if something went wrong.
b) If even this seems to be too risky, a possible alternative to deleting
the target directory may be to just make its modification timestamp
older than one of its prerequisites. But I doubt that there is a (portable)
way to do this, plus the target may not have any prerequisites! So this
would only be a last resort hack.

Cheers,

Chris





reply via email to

[Prev in Thread] Current Thread [Next in Thread]