makefiles writing to $@ should first write to $@.new

2022-01-23 Thread Justin Pryzby
There are many Makefile rules like foo: bar ./tool $< > $@ If the rule is interrupted (due to ^C or ENOSPC), foo can be 0 bytes or partially written, but won't be rebuilt until someone runs distclean or debugs it and removes the individual file, as I did for errcodes.h. It'd be better if

Re: makefiles writing to $@ should first write to $@.new

2022-01-23 Thread Michael Paquier
On Sun, Jan 23, 2022 at 09:23:05PM -0600, Justin Pryzby wrote: > If the rule is interrupted (due to ^C or ENOSPC), foo can be 0 bytes or > partially written, but won't be rebuilt until someone runs distclean or debugs > it and removes the individual file, as I did for errcodes.h. Honestly, I am no

Re: makefiles writing to $@ should first write to $@.new

2022-01-23 Thread Julien Rouhaud
Hi, On Mon, Jan 24, 2022 at 12:41:49PM +0900, Michael Paquier wrote: > On Sun, Jan 23, 2022 at 09:23:05PM -0600, Justin Pryzby wrote: > > If the rule is interrupted (due to ^C or ENOSPC), foo can be 0 bytes or > > partially written, but won't be rebuilt until someone runs distclean or > > debugs

Re: makefiles writing to $@ should first write to $@.new

2022-01-24 Thread Tom Lane
Julien Rouhaud writes: > On Mon, Jan 24, 2022 at 12:41:49PM +0900, Michael Paquier wrote: >> Honestly, I am not sure that this worth bothering about. This comes >> down to a balance between the code complexity and the likelihood of a >> failure, and the odds are not in favor of the later IMO. No

Re: makefiles writing to $@ should first write to $@.new

2022-01-24 Thread Peter Eisentraut
On 24.01.22 04:23, Justin Pryzby wrote: There are many Makefile rules like foo: bar ./tool $< > $@ If the rule is interrupted (due to ^C or ENOSPC), foo can be 0 bytes or partially written, but won't be rebuilt until someone runs distclean or debugs it and removes the individual file, a