Re: Patch for Makefile race against current cvs - Mailing list pgsql-patches

From Klaus Naumann
Subject Re: Patch for Makefile race against current cvs
Date
Msg-id Pine.LNX.4.40.0111090841300.7278-100000@kn.technik.gmx.net
Whole thread Raw
In response to Re: Patch for Makefile race against current cvs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Patch for Makefile race against current cvs
List pgsql-patches
On Thu, 8 Nov 2001, Tom Lane wrote:

> Klaus Naumann <knaumann@gmx-ag.de> writes:
> > attached is a patch which kills a race condition in the current Makefile
> > system. The Problem occurs if you compile with make -j3 (as many ppl
> > with Dual CPU Systems will do).
> > Removing the y.tab.X file is not a good idea as this will trigger
> > a second compile in the make install stage ...
>
> Why?  y.tab.X are not make targets, only intermediate files, so I don't
> see why removing them will create any problem.  And I don't see why
> turning them into make targets as your patch does is a good idea.

It is ... the problem is that with the current Makefile there
are always two files which need the .y files
(i.e. preproc.c and preproc.h). If you now do a make -j3,
make will start things in parallel. This means that bison is called twice
(it can even be called the same time which corrupts the output
y.tab.* files) and if you mv the files away the second call
failes as the second mv can't find the file anymore.
Even a test -f y.tab.c && mv doesn't help as I have
seen cases when the race was that bad that test found the
file but mv didn't anymore ...

So the solution is: Turn the bison and mv part into a single
target which get's called once.
This involves making y.tab.c a target. And to avoid a second
compilation on make install it's necessary to not remove
those files (turn mv into cp).

Also I don't see why keeping the y.tab.* files is a problem.
Neither are they big, nor are they installed or anything.
They are like a .o file ...

    Later, Klaus

--
Klaus Naumann
Systems Administration
GMX  Aktiengesellschaft
Riesstrasse 17, 80992 München
Telefon +49.89.143 39-0
Telefax +49.89.143 39-100
mailto:knaumann@gmx-ag.de
http://www.gmx.net/


pgsql-patches by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: Call for objections: revision of keyword classification
Next
From: "Greg Sabino Mullane"
Date:
Subject: Re: Enhanced index details using \d in psql