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

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: makefiles writing to $@ should first write to $@.new
Date: 2022-01-24 03:23:05
Message-ID: 20220124032305.GR23027@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 these did

./tool $< > $(at)(dot)new
mv $(at)(dot)new $@

--
Justin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-01-24 03:30:49 Re: Catalog version access
Previous Message Amit Kapila 2022-01-24 03:06:38 Re: Skipping logical replication transactions on subscriber side