pgsql-7.3.3: Build process not SMP clean - Mailing list pgsql-patches

From Andreas Haumer
Subject pgsql-7.3.3: Build process not SMP clean
Date
Msg-id 3F262D12.4070909@xss.co.at
Whole thread Raw
Responses Re: pgsql-7.3.3: Build process not SMP clean  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Hi!

There is a small bug in PostgreSQL 7.3.3 which makes
the build process fail sometimes on SMP machines with
"make -j n" (n>1)

Ths problem is in the src/backend/catalog/genbki.sh
script, which gets executed twice during the build
process. On SMP machines, and with "make -j", chances are
high that both executions are in parallel (at the same time).

But genbki.sh is not SMP safe: it uses a temporary file

TMPFILE="$TMPDIR/genbkitmp.c"

which of course is the same for both instances of genbki.sh
and chances are high, the temporary file gets corrupted and
compilation of this file then fails.

I made the following patch to solve this:

--- postgresql/src/backend/catalog/genbki.sh.orig       2003-07-29 09:37:20.000000000 +0200
+++ postgresql/src/backend/catalog/genbki.sh    2003-07-29 09:37:53.000000000 +0200
@@ -113,7 +113,7 @@
 fi


-TMPFILE="$TMPDIR/genbkitmp.c"
+TMPFILE="$TMPDIR/genbkitmp-$$.c"

 trap "rm -f $TMPFILE ${OUTPUT_PREFIX}.bki.$$ ${OUTPUT_PREFIX}.description.$$" 0 1 2 3 15


I think, it should be obvious. I tested the patch several times
on a Dual-Xeon hyperthreaded machine with "make -j 4" and now
every single build works (without the patch, 2 out of 3 builds
fail). Please apply.

Regards,

- andreas

--
Andreas Haumer                     | mailto:andreas@xss.co.at
*x Software + Systeme              | http://www.xss.co.at/
Karmarschgasse 51/2/20             | Tel: +43-1-6060114-0
A-1100 Vienna, Austria             | Fax: +43-1-6060114-71


pgsql-patches by date:

Previous
From: "Serguei A. Mokhov"
Date:
Subject: [pgsql-rus] Russian NLS update: pg_dump, libpq, pg_controldata, pg_resetxlog, pgscripts (fwd)
Next
From: Tom Lane
Date:
Subject: Re: pgsql-7.3.3: Build process not SMP clean