Re: DTrace build dependency rules - Mailing list pgsql-hackers

From Robert Haas
Subject Re: DTrace build dependency rules
Date
Msg-id CA+Tgmoa9NP2OnbmaxQRd-73mJjpSyTkP7jtpg35CngZ+kG6C0Q@mail.gmail.com
Whole thread Raw
In response to DTrace build dependency rules  (Mark Johnston <markj@FreeBSD.org>)
Responses Re: DTrace build dependency rules  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Sat, Aug 15, 2015 at 6:45 PM, Mark Johnston <markj@freebsd.org> wrote:
> There seems to be a bug in the make rules when DTrace is enabled. It
> causes dtrace -G to be invoked twice when building PostgreSQL as a
> FreeBSD port: once during the build itself, and once during
> installation. For a long time this has been worked around on FreeBSD
> with a change to libdtrace itself, but this workaround is proving
> problematic and I'd like to fix the problem properly. I'm not sure
> whether the problem has been observed on other operating systems that
> support DTrace.
>
> The bug is in src/backend/Makefile. probes.o, the dtrace(1)-generated
> object file, depends on the objfiles.txt for each of the backend
> subdirs. These files depend in turn on the object files themselves; if
> objfiles.txt is out of date with respect to one of its object files, the
> mtime of objfiles.txt is updated with "touch" (see backend/common.mk).
> The problem is that dtrace -G, which runs at the end of the build,
> modifies a number of object files (it overwrites their probe sites with
> NOPs), thus making their corresponding objfiles.txt out of date. Then,
> when "make install" traverses the backend subdirs, it updates
> objfiles.txt, which causes probes.o to be rebuilt, resulting in an error
> from dtrace(1).

Gosh, that's pretty ugly.  I would have thought it would be a real
no-no to update the .o file once it got generated.  If nothing else, a
modification to the .c file concurrent with a make invocation might
lead to the .o not getting rebuilt the next time make is run.

> The attached patch fixes the problem by having probes.o depend on object
> files directly, rather than on objfiles.txt. I've tested it with
> PostgreSQL 9.0-9.4 on FreeBSD CURRENT.

I don't see a particular reason not to make this change, though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: jsonb array-style subscripting
Next
From: Stephen Frost
Date:
Subject: Re: WIP: SCRAM authentication