On Fri, 2012-01-06 at 17:19 -0500, Gaetan Nadon wrote:
> On 12-01-06 11:19 AM, Colin Walters wrote:
> > On Fri, 2012-01-06 at 10:52 -0500, Gaetan Nadon wrote:
> >
> >> +sr.cpp : sr.g4a
> >> +  $(srcdir)/pre_cpp.py $(srcdir)/sr.g4a > $@
> > I recommend writing custom build commands to be atomic.  Which means:
> >
> > $(srcdir)/pre_cpp.py $(srcdir)/sr.g4a > [email protected] && mv [email protected] $@
> >
> > This way if the developer uses Control-C to send SIGINT to the process
> > group which kills the command in the middle of a write (or the command
> > crashes), you don't spend any time debugging the later program which is
> > consuming a half-written input file.  In some cases this can cause very
> > subtle corruption or errors.
> This is news to me. Makes sense. For the gcc command, would it not take
> care of removing output before exiting?

>From a quick:
strace -f -erename gcc -o foo foo.c

Nothing in that process chain invokes rename(2), so it can't be atomic.
It's probably worth patching automake at some point to output atomic
rules, but anyways I do it in my custom rules.

See also https://github.com/apenwarr/redo


_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to