libfq: Fix builds on Fedora 42 (GCC 15). Took the patch from upstream:
authorDevrim Gunduz <devrim@gunduz.org>
Fri, 19 Sep 2025 14:50:43 +0000 (09:50 -0500)
committerDevrim Gunduz <devrim@gunduz.org>
Fri, 19 Sep 2025 14:50:43 +0000 (09:50 -0500)
  e966732bf8f611809ef0b, so will be removed in next release.

rpm/redhat/main/common/libfq/EL-10/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/EL-8/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/EL-9/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/F-41/libfq-0.5.0.patch [deleted symlink]
rpm/redhat/main/common/libfq/F-41/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/F-42/libfq-0.5.0.patch [deleted symlink]
rpm/redhat/main/common/libfq/F-42/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/SLES-15/libfq-c23.patch [new symlink]
rpm/redhat/main/common/libfq/main/libfq-0.5.0.patch [deleted file]
rpm/redhat/main/common/libfq/main/libfq-c23.patch [new file with mode: 0644]
rpm/redhat/main/common/libfq/main/libfq.spec

diff --git a/rpm/redhat/main/common/libfq/EL-10/libfq-c23.patch b/rpm/redhat/main/common/libfq/EL-10/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/EL-8/libfq-c23.patch b/rpm/redhat/main/common/libfq/EL-8/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/EL-9/libfq-c23.patch b/rpm/redhat/main/common/libfq/EL-9/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/F-41/libfq-0.5.0.patch b/rpm/redhat/main/common/libfq/F-41/libfq-0.5.0.patch
deleted file mode 120000 (symlink)
index 62a495a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../main/libfq-0.5.0.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/F-41/libfq-c23.patch b/rpm/redhat/main/common/libfq/F-41/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/F-42/libfq-0.5.0.patch b/rpm/redhat/main/common/libfq/F-42/libfq-0.5.0.patch
deleted file mode 120000 (symlink)
index 62a495a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../main/libfq-0.5.0.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/F-42/libfq-c23.patch b/rpm/redhat/main/common/libfq/F-42/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/SLES-15/libfq-c23.patch b/rpm/redhat/main/common/libfq/SLES-15/libfq-c23.patch
new file mode 120000 (symlink)
index 0000000..dea7665
--- /dev/null
@@ -0,0 +1 @@
+../main/libfq-c23.patch
\ No newline at end of file
diff --git a/rpm/redhat/main/common/libfq/main/libfq-0.5.0.patch b/rpm/redhat/main/common/libfq/main/libfq-0.5.0.patch
deleted file mode 100644 (file)
index addfc33..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-From 7d8600992b641cc10e0dd9e5a1e05c48b3828a02 Mon Sep 17 00:00:00 2001
-From: Ian Barwick <barwick@gmail.com>
-Date: Fri, 30 Dec 2022 15:22:43 +0900
-Subject: [PATCH] Fix isc_blob_handle initialization
-
-Should be "0", not "NULL".
-
-GitHub #4.
----
- src/libfq.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/libfq.c b/src/libfq.c
-index 3ce0c10..1eed425 100644
---- a/src/libfq.c
-+++ b/src/libfq.c
-@@ -1900,8 +1900,8 @@ _FQexecParams(FBconn *conn,
-                               case SQL_BLOB:
-                               {
--                                      /* must be initialised to NULL */
--                                      isc_blob_handle blob_handle = NULL;
-+                                      /* must be initialised to 0 */
-+                                      isc_blob_handle blob_handle = 0;
-                                       char *ptr = (char *)paramValues[i];
-                                       len = strlen(paramValues[i]);
-@@ -3479,8 +3479,8 @@ _FQformatDatum(FBconn *conn, FQresTupleAttDesc *att_desc, XSQLVAR *var)
-         {
-             ISC_QUAD *blob_id = (ISC_QUAD *)var->sqldata;
--            /* must be initialised to NULL */
--            isc_blob_handle blob_handle = NULL;
-+            /* must be initialised to 0 */
-+            isc_blob_handle blob_handle = 0;
-             char blob_segment[BLOB_SEGMENT_LEN];
-             unsigned short actual_seg_len;
-             ISC_STATUS blob_status;
diff --git a/rpm/redhat/main/common/libfq/main/libfq-c23.patch b/rpm/redhat/main/common/libfq/main/libfq-c23.patch
new file mode 100644 (file)
index 0000000..70862b0
--- /dev/null
@@ -0,0 +1,152 @@
+From e966732f28a305387e2b9f4b0f230671e942351e Mon Sep 17 00:00:00 2001
+From: Ian Barwick <barwick@gmail.com>
+Date: Mon, 26 May 2025 23:23:48 +0900
+Subject: [PATCH] Fix some further compiler warnings
+
+With "-Wstringop-truncation", the compiler is fretting about a
+possible missing terminating NUL character, even though we explicitly
+set that immediately after the strncpy call.
+
+Initializing the entire buffer with NUL characters before calling
+strncpy makes the issue go away.
+
+Per report in GitHub #8.
+---
+ src/libfq.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/src/libfq.c b/src/libfq.c
+index 539e2fd..7dd2e05 100644
+--- a/src/libfq.c
++++ b/src/libfq.c
+@@ -294,8 +294,8 @@ FQconnectdbParams(const char * const *keywords,
+       /* store database path */
+       db_path_len = strlen(db_path);
+       conn->db_path = malloc(db_path_len + 1);
+-      strncpy(conn->db_path, db_path, db_path_len);
+-      conn->db_path[db_path_len] = '\0';
++      memset(conn->db_path, '\0', db_path_len + 1);
++      strncpy(conn->db_path, db_path, db_path_len + 1);
+       /* set and store other parameters */
+       if (uname != NULL)
+@@ -305,8 +305,8 @@ FQconnectdbParams(const char * const *keywords,
+               isc_modify_dpb(&dpb, &conn->dpb_length, isc_dpb_user_name, uname, uname_len);
+               conn->uname = malloc(uname_len + 1);
+-              strncpy(conn->uname, uname, uname_len);
+-              conn->uname[uname_len] = '\0';
++              memset(conn->uname, '\0', uname_len + 1);
++              strncpy(conn->uname, uname, uname_len + 1);
+       }
+       if (upass != NULL)
+@@ -316,8 +316,8 @@ FQconnectdbParams(const char * const *keywords,
+               isc_modify_dpb(&dpb, &conn->dpb_length, isc_dpb_password, upass, upass_len);
+               conn->upass = malloc(upass_len + 1);
+-              strncpy(conn->upass, upass, upass_len);
+-              conn->upass[upass_len] = '\0';
++              memset(conn->upass, '\0', upass_len + 1);
++              strncpy(conn->upass, upass, upass_len + 1);
+       }
+       /*
+From 809ef0bccfb0c6b8cd2852adf4777d7f45dc577f Mon Sep 17 00:00:00 2001
+From: Ian Barwick <barwick@gmail.com>
+Date: Fri, 18 Apr 2025 18:39:26 +0900
+Subject: [PATCH] Update boolean handling for C23 standard
+
+There was a reason for manually defining a boolean type, possibly
+because back in the day (12 years or so ago) it was what PostgreSQL
+itself did, but C is now far enough into the 21st century that it
+seems reasonable to assume <stdbool.h> is universally available.
+
+See also PostgreSQL core commit bc5a4dfcf73.
+
+GitHub #8.
+---
+ include/libfq.h | 25 +------------------------
+ 1 file changed, 1 insertion(+), 24 deletions(-)
+
+diff --git a/include/libfq.h b/include/libfq.h
+index 7e37e99..31a39ed 100644
+--- a/include/libfq.h
++++ b/include/libfq.h
+@@ -2,35 +2,12 @@
+ #define LIBFQ_H
+ #include <stdlib.h>
++#include <stdbool.h>
+ #include <ibase.h>
+ #ifndef C_H
+ #define C_H
+-
+-#ifndef BOOL
+-#define BOOL
+-typedef char bool;
+-
+-
+-#ifndef true
+-#define true    ((bool) 1)
+-#endif
+-
+-#ifndef false
+-#define false   ((bool) 0)
+-#endif
+-
+-typedef bool *BoolPtr;
+-
+-#ifndef TRUE
+-#define TRUE    1
+-#endif
+-
+-#ifndef FALSE
+-#define FALSE   0
+-#endif
+-#endif
+ /*
+  * lengthof
+  *              Number of elements in an array.
+From bf8f6112c032c8d464ac8ac2b50d71a24a17ce61 Mon Sep 17 00:00:00 2001
+From: Ian Barwick <barwick@gmail.com>
+Date: Fri, 18 Apr 2025 19:02:26 +0900
+Subject: [PATCH] Miscellaneous code cleanup
+
+Addresses various compiler warnings, including those noted in GitHub #8.
+---
+ src/libfq.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/src/libfq.c b/src/libfq.c
+index fd60a26..539e2fd 100644
+--- a/src/libfq.c
++++ b/src/libfq.c
+@@ -26,6 +26,7 @@
+ #include <stdio.h>
+ #include <string.h>
++#include <strings.h>
+ #include <stdlib.h>
+ #include <stdint.h>
+ #include <sys/time.h>
+@@ -3658,7 +3659,7 @@ _FQformatDatum(FBconn *conn, FQresTupleAttDesc *att_desc, XSQLVAR *var)
+                       if (var->sqlsubtype == 1)
+                       {
+                               /* column defined as "CHARACTER SET OCTETS" */
+-                              p = _FQformatOctet(vary2->vary_string, vary2->vary_length);
++                              p = _FQformatOctet((char *)vary2->vary_string, vary2->vary_length);
+                       }
+                       else
+                       {
+@@ -3708,7 +3709,7 @@ _FQformatDatum(FBconn *conn, FQresTupleAttDesc *att_desc, XSQLVAR *var)
+                               if (value >= 0)
+                               {
+-                                      p = (char *)malloc(buflen);
++                                      p = (char *)malloc(buflen + 1);
+                                       sprintf(p, "%lld.%0*lld",
+                                                       (ISC_INT64) value / tens,
+                                                       -dscale,
index 0405b2e520a62d6dc1ace529668629d81c7081d1..9265abb6a1937e6758c9823a9b0b1dcc1c4e372d 100644 (file)
@@ -1,7 +1,7 @@
 Summary:       A wrapper library for the Firebird C API
 Name:          libfq
 Version:       0.6.1
-Release:       2PGDG%{dist}
+Release:       3PGDG%{dist}
 Source:                https://github.com/ibarwick/%{name}/archive/%{version}.tar.gz
 Patch0:                %{name}-c23.patch
 URL:           https://github.com/ibarwick/%{name}
@@ -39,6 +39,10 @@ A wrapper library for the Firebird C API, loosely based on libpq for PostgreSQL.
 %{_includedir}/%{name}.h
 
 %changelog
+* Fri Sep 19 2025 Devrim Gündüz <devrim@gunduz.org> - 0.6.1-3PGDG
+- Fix builds on Fedora 42 (GCC 15). Took the patch from upstream:
+  e966732, bf8f611, 809ef0b, so will be removed in next release.
+
 * Mon May 5 2025 Devrim Gündüz <devrim@gunduz.org> - 0.6.1-2PGDG
 - Remove RHEL 7 support