v25-0002-Remove-fe_memutils-from-libpgcommon_shlib.patch

application/octet-stream

Filename: v25-0002-Remove-fe_memutils-from-libpgcommon_shlib.patch
Type: application/octet-stream
Part: 4
Message: Re: [PoC] Federated Authn/z with OAUTHBEARER

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v25-0002
Subject: Remove fe_memutils from libpgcommon_shlib
File+
src/common/Makefile 3 2
src/common/meson.build 3 2
From 6b6d48e0013fd9cb82e812779e78e70e8ebcf3ee Mon Sep 17 00:00:00 2001
From: Jacob Champion <jacob.champion@enterprisedb.com>
Date: Mon, 1 Jul 2024 14:18:33 -0700
Subject: [PATCH v25 2/7] Remove fe_memutils from libpgcommon_shlib

libpq must not use palloc/pfree. It's not allowed to exit on allocation
failure, and mixing the frontend pfree with malloc is architecturally
unsound.

Remove fe_memutils from the shlib build entirely, to keep devs from
accidentally depending on it in the future.
---
 src/common/Makefile    | 5 +++--
 src/common/meson.build | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/common/Makefile b/src/common/Makefile
index 3d83299432..3049cf26ba 100644
--- a/src/common/Makefile
+++ b/src/common/Makefile
@@ -102,14 +102,15 @@ endif
 # A few files are currently only built for frontend, not server.
 # logging.c is excluded from OBJS_FRONTEND_SHLIB (shared library) as
 # a matter of policy, because it is not appropriate for general purpose
-# libraries such as libpq to report errors directly.
+# libraries such as libpq to report errors directly. fe_memutils.c is
+# excluded because libpq must not exit() on allocation failure.
 OBJS_FRONTEND_SHLIB = \
 	$(OBJS_COMMON) \
-	fe_memutils.o \
 	restricted_token.o \
 	sprompt.o
 OBJS_FRONTEND = \
 	$(OBJS_FRONTEND_SHLIB) \
+	fe_memutils.o \
 	logging.o
 
 # foo.o, foo_shlib.o, and foo_srv.o are all built from foo.c
diff --git a/src/common/meson.build b/src/common/meson.build
index de68e408fa..f72628a646 100644
--- a/src/common/meson.build
+++ b/src/common/meson.build
@@ -101,17 +101,18 @@ common_sources_cflags = {
 # A few files are currently only built for frontend, not server.
 # logging.c is excluded from OBJS_FRONTEND_SHLIB (shared library) as
 # a matter of policy, because it is not appropriate for general purpose
-# libraries such as libpq to report errors directly.
+# libraries such as libpq to report errors directly. fe_memutils.c is
+# excluded because libpq must not exit() on allocation failure.
 
 common_sources_frontend_shlib = common_sources
 common_sources_frontend_shlib += files(
-  'fe_memutils.c',
   'restricted_token.c',
   'sprompt.c',
 )
 
 common_sources_frontend_static = common_sources_frontend_shlib
 common_sources_frontend_static += files(
+  'fe_memutils.c',
   'logging.c',
 )
 
-- 
2.34.1