Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 562901337B63 for ; Sun, 30 Jan 2011 14:27:22 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 49053-07 for ; Sun, 30 Jan 2011 18:27:15 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id D002F13364DE for ; Sun, 30 Jan 2011 14:27:14 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p0UIRBtk002696; Sun, 30 Jan 2011 13:27:11 -0500 (EST) To: Peter Eisentraut cc: pgsql-bugs@postgresql.org, Dylan Alex Simon Subject: Re: BUG #5665: catalog/schemapg.h: No such file or directory In-reply-to: <2146.1296409499@sss.pgh.pa.us> References: <20110129114655.GA10393@datura.dylex.net> <2146.1296409499@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sun, 30 Jan 2011 12:44:59 -0500" Date: Sun, 30 Jan 2011 13:27:11 -0500 Message-ID: <2695.1296412031@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201101/242 X-Sequence-Number: 29264 I wrote: > Dylan Alex Simon writes: >> I'm seeing this problem too, so I might be able to shed some light on it. > Hm. I can't replicate this at all. > ... >> GNU Make 3.82 > Mine is 3.81 (Fedora 13). Is it possible this is a bug introduced in > 3.82? The symlink is made this way: > $(top_builddir)/src/include/catalog/schemapg.h: catalog/schemapg.h > prereqdir=`cd $(dir $<) >/dev/null && pwd` && \ > cd $(dir $@) && rm -f $(notdir $@) && \ > $(LN_S) "$$prereqdir/$(notdir $<)" . Ah-hah: when I try it on Fedora 14 (with make 3.82), it fails just as Dylan describes. Doing it manually in builddir/src/backend shows that "dir $<" is indeed the culprit: $ rm ../../src/include/catalog/schemapg.h $ make ../../src/include/catalog/schemapg.h make -C catalog schemapg.h make[1]: Entering directory `/home/tgl/tmp/postgresql-9.0.2/obj-x86_64/src/backend/catalog' make[1]: `/home/tgl/tmp/postgresql-9.0.2/src/src/backend/catalog/schemapg.h' is up to date. make[1]: Leaving directory `/home/tgl/tmp/postgresql-9.0.2/obj-x86_64/src/backend/catalog' prereqdir=`cd catalog/ >/dev/null && pwd` && \ cd ../../src/include/catalog/ && rm -f schemapg.h && \ ln -s "$prereqdir/schemapg.h" . $ ls -l ../../src/include/catalog/schemapg.h lrwxrwxrwx. 1 tgl tgl 72 Jan 30 13:03 ../../src/include/catalog/schemapg.h -> /home/tgl/tmp/postgresql-9.0.2/obj-x86_64/src/backend/catalog/schemapg.h Now, this make rule looks exactly like the one for parser/gram.h, and that's not misbehaving. The problem appears to be caused by the other rule for schemapg.h: # run this unconditionally to avoid needing to know its dependencies here: submake-schemapg: $(MAKE) -C catalog schemapg.h .PHONY: submake-schemapg catalog/schemapg.h: submake-schemapg If I comment this out entirely, or change it to a simple rule catalog/schemapg.h: $(MAKE) -C catalog schemapg.h then the symlink is built correctly. Apparently, the use of a phony dependency causes make to decide that "catalog/schemapg.h" must refer to a file in the build tree not the source tree. I'm not sure whether the gmake boys will think this is a bug. It's certainly a behavior change from pre-3.82 releases. In any case, I think the rule for catalog/schemapg.h is a bit too cute (and even more so in HEAD ... WTF is that "|" in there now?). We need to be less bleeding edge here. regards, tom lane