Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name - Mailing list pgsql-bugs

From Andy Bailey
Subject Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name
Date
Msg-id 20220715161357.rezc6eohze3ebaya@akamai.com
Whole thread Raw
Responses Re: Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
List pgsql-bugs
Hi All,

 Recently I was debugging an issue in which builds of postgresql
 succeeded on a developer's workstation, but failed in our company's
 build system.

 After some investigation, I found that the value of pkglibdir (as used
 by src/Makefile.global and various other places) was different even
 though the ./configure invocations were identical. Eventually, I found
 that Makefile.global was the culprit, with some sections like:

pkglibdir = $(libdir)
ifeq "$(findstring pgsql, $(pkglibdir))" ""
ifeq "$(findstring postgres, $(pkglibdir))" ""
override pkglibdir := $(pkglibdir)/postgresql
endif
endif

 On the developer's workstation, the sources had been unpacked in a
 directory, e.g. (the structure is a quirk convention of an internal
 tool)

  $HOME/src/postgresql13-13.7/source

 On the production build system, the path used was:

 /build/source

 The --prefix used is a subdirectory of the source directory (in this
 context we're only building the source to get the static libpq and
 headers, which we use to build another piece of software).

 On the developer's workstation, the string "postgres" is part of the
 path, and thus pkglibdir does not get "postgresql" appended via an
 override (nor any of the other variables). But on the build system,
 both tests pass, and the override with appended "postgresql" do occur.

 I'm assuming that the intention of findstring postgres was to tidy up
 values like pkglibdir when libdir is e.g. /usr/lib/postgres/, which
 makes sense, but not when "postgres" appears in libdir for some other
 reason.

 We're able to patch around this, but I thought it might be worth
 reporting. I considered devising a patch but haven't yet thought of a
 good strategy, and I suspect it might be trick to avoid breaking other
 users who may (even unwittingly) rely on this quirk. I would be
 delighted to accept any suggestions however.

 Thanks!
 
  .andy



pgsql-bugs by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: BUG #17496: to_char function resets if interval exceeds 23 hours 59 minutes
Next
From: Alvaro Herrera
Date:
Subject: Re: Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name