pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles.
@ 2026-09-30 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-09-30 19:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect parallel build of jsonapi.o with Makefiles.

Commit 0785d1b8b wrote

jsonapi_shlib.o: override CPPFLAGS += -DJSONAPI_USE_PQEXPBUFFER

forgetting that GNU make treats this change to CPPFLAGS as affecting
not only jsonapi_shlib.o, but anything that gets built in pursuit of
building jsonapi_shlib.o.  Because of an even more ancient hack
(cf 7143b3e82), that will include jsonapi.o if it's not been built
already.  If we do apply this -D switch to jsonapi.o, it gets built
with the wrong expansible-string infrastructure, which manifests
immediately as a link failure in pg_combinebackup and would misbehave
at runtime even if the build somehow completed.

Perhaps remarkably, we'd not seen field reports of build failures
till now, but it's pretty easy to reproduce a mis-build by trying
to build src/common/ with --shuffle and a high -j factor.

To fix, don't modify CPPFLAGS this way; instead make a dedicated
build rule for jsonapi_shlib.o that injects the additional switches.

There might be other places with similar problems, but some desultory
attempts with -j32 --shuffle on a 32-thread CPU didn't find any more
build failures.  Also, it looks like the meson build infrastructure
lacks this problem (but I'm no meson expert).

Bug: #19727
Reported-by: Ross Burton <ross@burtonini.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ross Burton <ross@burtonini.com>
Discussion: https://postgr.es/m/19727-32d67d9dea410f38@postgresql.org
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ee089509690eabf3ae1603896652190d3ff41f41

Modified Files
--------------
src/common/Makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles.
@ 2026-09-30 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-09-30 19:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect parallel build of jsonapi.o with Makefiles.

Commit 0785d1b8b wrote

jsonapi_shlib.o: override CPPFLAGS += -DJSONAPI_USE_PQEXPBUFFER

forgetting that GNU make treats this change to CPPFLAGS as affecting
not only jsonapi_shlib.o, but anything that gets built in pursuit of
building jsonapi_shlib.o.  Because of an even more ancient hack
(cf 7143b3e82), that will include jsonapi.o if it's not been built
already.  If we do apply this -D switch to jsonapi.o, it gets built
with the wrong expansible-string infrastructure, which manifests
immediately as a link failure in pg_combinebackup and would misbehave
at runtime even if the build somehow completed.

Perhaps remarkably, we'd not seen field reports of build failures
till now, but it's pretty easy to reproduce a mis-build by trying
to build src/common/ with --shuffle and a high -j factor.

To fix, don't modify CPPFLAGS this way; instead make a dedicated
build rule for jsonapi_shlib.o that injects the additional switches.

There might be other places with similar problems, but some desultory
attempts with -j32 --shuffle on a 32-thread CPU didn't find any more
build failures.  Also, it looks like the meson build infrastructure
lacks this problem (but I'm no meson expert).

Bug: #19727
Reported-by: Ross Burton <ross@burtonini.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ross Burton <ross@burtonini.com>
Discussion: https://postgr.es/m/19727-32d67d9dea410f38@postgresql.org
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a78719fb129ecdb3f3fa2b695ea38c5b8fe9f4f8

Modified Files
--------------
src/common/Makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles.
@ 2026-09-30 19:58 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-09-30 19:58 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix incorrect parallel build of jsonapi.o with Makefiles.

Commit 0785d1b8b wrote

jsonapi_shlib.o: override CPPFLAGS += -DJSONAPI_USE_PQEXPBUFFER

forgetting that GNU make treats this change to CPPFLAGS as affecting
not only jsonapi_shlib.o, but anything that gets built in pursuit of
building jsonapi_shlib.o.  Because of an even more ancient hack
(cf 7143b3e82), that will include jsonapi.o if it's not been built
already.  If we do apply this -D switch to jsonapi.o, it gets built
with the wrong expansible-string infrastructure, which manifests
immediately as a link failure in pg_combinebackup and would misbehave
at runtime even if the build somehow completed.

Perhaps remarkably, we'd not seen field reports of build failures
till now, but it's pretty easy to reproduce a mis-build by trying
to build src/common/ with --shuffle and a high -j factor.

To fix, don't modify CPPFLAGS this way; instead make a dedicated
build rule for jsonapi_shlib.o that injects the additional switches.

There might be other places with similar problems, but some desultory
attempts with -j32 --shuffle on a 32-thread CPU didn't find any more
build failures.  Also, it looks like the meson build infrastructure
lacks this problem (but I'm no meson expert).

Bug: #19727
Reported-by: Ross Burton <ross@burtonini.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ross Burton <ross@burtonini.com>
Discussion: https://postgr.es/m/19727-32d67d9dea410f38@postgresql.org
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a70876d7bf44feb41b431daf7baca07d7413d2ef

Modified Files
--------------
src/common/Makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-09-30 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-30 19:58 pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles. Tom Lane <tgl@sss.pgh.pa.us>
2026-09-30 19:58 pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles. Tom Lane <tgl@sss.pgh.pa.us>
2026-09-30 19:58 pgsql: Fix incorrect parallel build of jsonapi.o with Makefiles. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox