Re: Patch for Makefile race against current cvs

From: Klaus Naumann <knaumann(at)gmx-ag(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Klaus Naumann <knaumann(at)gmx-ag(dot)de>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Patch for Makefile race against current cvs
Date: 2001-11-09 07:48:46
Message-ID: Pine.LNX.4.40.0111090841300.7278-100000@kn.technik.gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Thu, 8 Nov 2001, Tom Lane wrote:

> Klaus Naumann <knaumann(at)gmx-ag(dot)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(at)gmx-ag(dot)de
http://www.gmx.net/

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Greg Sabino Mullane 2001-11-09 14:53:17 Re: Enhanced index details using \d in psql
Previous Message Thomas Lockhart 2001-11-09 06:21:57 Re: Call for objections: revision of keyword classification