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

From: Andy Bailey <bailey(at)akamai(dot)com>
To: <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Makefile.global will override configure parameters if "pgsql" and "postgres" appear anywhere in the source path name
Date: 2022-07-15 16:13:57
Message-ID: 20220715161357.rezc6eohze3ebaya@akamai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

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