Skip to contentSkip to conversation

pgpool2: upgrade 4.5.1 -> 4.5.2

PATCH New Gyorgy Sarvari 1 participant 4 messages Sep 11, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 pgpool2: upgrade 4.5.1 -> 4.5.2

From: Jason Schonberg <[email protected]>

Fixes for memory leaks, uninitialized memory, segmentation faults and other fixes.

Changelog: https://www.pgpool.net/docs/latest/en/html/release-4-5-2.html

---
 .../pgpool2/{pgpool2_4.5.1.bb => pgpool2_4.5.2.bb}              | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-networking/recipes-support/pgpool2/{pgpool2_4.5.1.bb => pgpool2_4.5.2.bb} (95%)
meta-networking/recipes-support/pgpool2/pgpool2_4.5.2.bb renamed from meta-networking/recipes-support/pgpool2/pgpool2_4.5.1.bb +1 -1
similarity index 95%
rename from meta-networking/recipes-support/pgpool2/pgpool2_4.5.1.bb
rename to meta-networking/recipes-support/pgpool2/pgpool2_4.5.2.bb
index ddcad46beb..0bf45c17ce 100644
@@ -16,7 +16,7 @@ SRC_URI = "http://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
 	   file://pgpool.sysconfig \
 	   file://pgpool.service \
            "
-SRC_URI[sha256sum] = "8e14b0558a15dae8767c8e1acee3f2f6c7c08ebfffda66a359367eaaa56c3936"
+SRC_URI[sha256sum] = "480ac23f01cd7d6c856b29386bf17a848712fb4b4057d4c8abd5c8bf819bdf06"
 
 S = "${WORKDIR}/pgpool-II-${PV}"
 
#1 lore raw

PATCH 2/4 pgpool2: upgrade 4.5.2 -> 4.5.3

From: Jason Schonberg <[email protected]>

Changelog: https://www.pgpool.net/docs/latest/en/html/release-4-5-3.html

---
 .../pgpool2/{pgpool2_4.5.2.bb => pgpool2_4.5.3.bb}            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename meta-networking/recipes-support/pgpool2/{pgpool2_4.5.2.bb => pgpool2_4.5.3.bb} (91%)
meta-networking/recipes-support/pgpool2/pgpool2_4.5.3.bb renamed from meta-networking/recipes-support/pgpool2/pgpool2_4.5.2.bb +2 -2
similarity index 91%
rename from meta-networking/recipes-support/pgpool2/pgpool2_4.5.2.bb
rename to meta-networking/recipes-support/pgpool2/pgpool2_4.5.3.bb
index 0bf45c17ce..09d756b289 100644
@@ -10,13 +10,13 @@ HOMEPAGE = "http://pgpool.net"
 LICENSE = "BSD-2-Clause"
 LIC_FILES_CHKSUM = "file://COPYING;md5=e4b38de086d73e0521de0bbdbaa4a1a9"
 
-SRC_URI = "http://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
+SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
 	   file://0001-Fix-build-error-when-build-this-file.patch \
 	   file://define_SIGNAL_ARGS.patch \
 	   file://pgpool.sysconfig \
 	   file://pgpool.service \
            "
-SRC_URI[sha256sum] = "480ac23f01cd7d6c856b29386bf17a848712fb4b4057d4c8abd5c8bf819bdf06"
+SRC_URI[sha256sum] = "25ed340d7b7dc00c20e4ba763d3f9c07ba891b150d9d48af313a1351cafdd778"
 
 S = "${WORKDIR}/pgpool-II-${PV}"
 
#2 lore raw

PATCH 3/4 pgpool2: upgrade 4.5.3 -> 4.5.4

In reply to Gyorgy Sarvari

From: Jason Schonberg <[email protected]>

This version brings a fix for CVE-2024-45624

Changlog: https://www.pgpool.net/docs/latest/en/html/release-4-5-4.html

---
 .../pgpool2/{pgpool2_4.5.3.bb => pgpool2_4.5.4.bb}              | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-networking/recipes-support/pgpool2/{pgpool2_4.5.3.bb => pgpool2_4.5.4.bb} (95%)
meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb renamed from meta-networking/recipes-support/pgpool2/pgpool2_4.5.3.bb +1 -1
similarity index 95%
rename from meta-networking/recipes-support/pgpool2/pgpool2_4.5.3.bb
rename to meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb
index 09d756b289..d3bfd4ba79 100644
@@ -16,7 +16,7 @@ SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
 	   file://pgpool.sysconfig \
 	   file://pgpool.service \
            "
-SRC_URI[sha256sum] = "25ed340d7b7dc00c20e4ba763d3f9c07ba891b150d9d48af313a1351cafdd778"
+SRC_URI[sha256sum] = "d1392e74ce2807f8ae628872cb1ab7914249921180dc99df40a1d602647a10fd"
 
 S = "${WORKDIR}/pgpool-II-${PV}"
 
#3 lore raw

PATCH 4/4 pgpool2: fix compiling for 32-bit arches

In reply to Gyorgy Sarvari

When compiling for 32-bit targets, two issues came to surface:

1. gcc was complaining that math.h is not included in snprintf, and some calls were implicitly defined. Added a patch that includes the required headers in snprintf.c file:

| snprintf.c: In function 'fmtfloat':
| snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
|  1232 |         if (isnan(value))
|       |             ^~~~~
| snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'

2. The code passes a time_t argument to a function that expects a long. This works for 64-bit targets, because on those usually time_t is long.
However on 32-bit systems time_t is usually long long, which makes compilation fail with the following error:

| wd_json_data.c:540:66: error: passing argument 3 of 'json_get_long_value_for_key' from incompatible pointer type [-Wincompatible-pointer-types]
|   540 |         if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
|       |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

To account for this, add a new helper method in a patch that returns the required json value as a time_t value.

The patches are in pending state, because the mailing list of the project is sufferring from technical problems - when the site loads, sign up attempts throw internal server errors.

It is planned to submit the patches and to update the status once their infrastructure is back.

---
 ...0001-fix-compiling-on-32-bit-systems.patch | 83 +++++++++++++++++++
 ...h.h-to-ensure-isnan-and-isinf-are-de.patch | 40 +++++++++
 .../recipes-support/pgpool2/pgpool2_4.5.4.bb  |  2 +
 3 files changed, 125 insertions(+)
 create mode 100644 meta-networking/recipes-support/pgpool2/pgpool2/0001-fix-compiling-on-32-bit-systems.patch
 create mode 100644 meta-networking/recipes-support/pgpool2/pgpool2/0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch
meta-networking/recipes-support/pgpool2/pgpool2/0001-fix-compiling-on-32-bit-systems.patch new file +83 -0
new file mode 100644
index 0000000000..cb6da7b08e
@@ -0,0 +1,83 @@
+From 523ca5546b0178be693943f2a3a880c0bd6ea239 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 11 Sep 2025 12:36:29 +0200
+Subject: [PATCH] fix compiling on 32-bit systems
+
+The timespec struct's tv_sec size can change between architectures.
+Usually on 64 bit systems it's long, but on 32 bit systems it is frequently long long.
+
+When the watchdog is trying to get the uptime, it is trying to get the value
+as long - however on 32 bit systems this fails due to different time_t size:
+
+| wd_json_data.c:540:66: error: passing argument 3 of 'json_get_long_value_for_key' from incompatible pointer type [-Wincompatible-pointer-types]
+|   540 |         if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
+|       |                                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To account for this, introduce a new helper function to get a json value as
+a time_t type.
+
+Upstream-Status: Pending [project ML registration is down]
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/include/utils/json.h    |  5 +++--
+ src/utils/json.c            | 14 ++++++++++++++
+ src/watchdog/wd_json_data.c |  2 +-
+ 3 files changed, 18 insertions(+), 3 deletions(-)
+
+diff --git a/src/include/utils/json.h b/src/include/utils/json.h
+index 67cc0255a..93be83c3a 100644
+--- a/src/include/utils/json.h
++++ b/src/include/utils/json.h
+@@ -311,10 +311,11 @@ extern "C"
+ #endif
+ 
+ /* pgpool-II extensions */
+-json_value *json_get_value_for_key(json_value * source, const char *key);
++json_value		*json_get_value_for_key(json_value * source, const char *key);
+ int			json_get_int_value_for_key(json_value * source, const char *key, int *value);
+ int			json_get_long_value_for_key(json_value * source, const char *key, long *value);
+-char	   *json_get_string_value_for_key(json_value * source, const char *key);
++char			*json_get_string_value_for_key(json_value * source, const char *key);
+ int			json_get_bool_value_for_key(json_value * source, const char *key, bool *value);
++int			json_get_time_value_for_key(json_value * source, const char *key, time_t *value);
+ 
+ #endif
+diff --git a/src/utils/json.c b/src/utils/json.c
+index 319c8fdbf..bce99466c 100644
+--- a/src/utils/json.c
++++ b/src/utils/json.c
+@@ -1204,6 +1204,20 @@ json_get_long_value_for_key(json_value * source, const char *key, long *value)
+ 	return 0;
+ }
+ 
++int
++json_get_time_value_for_key(json_value * source, const char *key, time_t *value)
++{
++        json_value *jNode;
++
++        jNode = json_get_value_for_key(source, key);
++        if (jNode == NULL)
++                return -1;
++        if (jNode->type != json_integer)
++                return -1;
++        *value = jNode->u.integer;
++        return 0;
++}
++
+ /*
+  * pgpool extension:
+  * returns string value if found for the key.
+diff --git a/src/watchdog/wd_json_data.c b/src/watchdog/wd_json_data.c
+index 474fc37a4..53053cd4b 100644
+--- a/src/watchdog/wd_json_data.c
++++ b/src/watchdog/wd_json_data.c
+@@ -537,7 +537,7 @@ get_watchdog_node_from_json(char *json_data, int data_len, char **authkey)
+ 	if (root == NULL || root->type != json_object)
+ 		goto ERROR_EXIT;
+ 
+-	if (json_get_long_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
++	if (json_get_time_value_for_key(root, "StartupTimeSecs", &wdNode->startup_time.tv_sec))
+ 	{
+ 		bool		escalated;
+ 		long		seconds_since_node_startup;
meta-networking/recipes-support/pgpool2/pgpool2/0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch new file +40 -0
new file mode 100644
index 0000000000..335761c9bf
@@ -0,0 +1,40 @@
+From c0b6ae020ad87040b5bc6fbae94fb815f10884d2 Mon Sep 17 00:00:00 2001
+From: Gyorgy Sarvari <[email protected]>
+Date: Thu, 11 Sep 2025 11:58:02 +0200
+Subject: [PATCH] snprintf: Add math.h to ensure isnan and isinf are defined
+
+When building for 32-bit arm arch, compilation fails with the following error:
+| snprintf.c: In function 'fmtfloat':
+| snprintf.c:1232:13: error: implicit declaration of function 'isnan' [-Wimplicit-function-declaration]
+|  1232 |         if (isnan(value))
+|       |             ^~~~~
+| snprintf.c:50:1: note: include '<math.h>' or provide a declaration of 'isnan'
+|    49 | #include "postgresql/server/port.h"
+|   +++ |+#include <math.h>
+|    50 |
+| snprintf.c:1254:21: error: implicit declaration of function 'isinf' [-Wimplicit-function-declaration]
+|  1254 |                 if (isinf(value))
+|       |                     ^~~~~
+| snprintf.c:1254:21: note: include '<math.h>' or provide a declaration of 'isinf'
+
+To avoid the error, add math.h to snprintf.c.
+
+Upstream-Status: Pending [project ML registration is down]
+
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/parser/snprintf.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/parser/snprintf.c b/src/parser/snprintf.c
+index 6dd4a50..cce7951 100644
+--- a/src/parser/snprintf.c
++++ b/src/parser/snprintf.c
+@@ -36,6 +36,7 @@
+ #include "c.h"
+ #endif
+ 
++#include <math.h>
+ #include <stdarg.h>
+ #include <stdio.h>
+ #include <stdint.h>
meta-networking/recipes-support/pgpool2/pgpool2_4.5.4.bb +2 -0
index d3bfd4ba79..8cec1535b8 100644
@@ -12,6 +12,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e4b38de086d73e0521de0bbdbaa4a1a9"
 
 SRC_URI = "https://www.pgpool.net/mediawiki/images/pgpool-II-${PV}.tar.gz \
 	   file://0001-Fix-build-error-when-build-this-file.patch \
+           file://0001-snprintf-Add-math.h-to-ensure-isnan-and-isinf-are-de.patch \
+           file://0001-fix-compiling-on-32-bit-systems.patch \
 	   file://define_SIGNAL_ARGS.patch \
 	   file://pgpool.sysconfig \
 	   file://pgpool.service \