Back-patching -Wno-format-truncation. - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Back-patching -Wno-format-truncation.
Date
Msg-id 20200304.081254.1538148731635518637.horikyota.ntt@gmail.com
Whole thread Raw
Responses Re: Back-patching -Wno-format-truncation.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello.  (added Tom in Cc:)

If I build the past versions from 9.4 to 9.6 with GCC8, I find it
really annoying to see the build screen filled with massive number of
warnings of format-truncation, stringop-truncation and
format-overflow.

Just applying the commit 416e3e318c as-is silences the first two.

The last one is silenced by applying 5d923eb29b.

The commit message is sayiing that it is back-patched back at least to
9.4, but it seem that the versions from 9.4 to 9.6 haven't got the
patches.

Tom, would you back-patch the two commits to from 9.4 to 9.6?

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
diff --git a/contrib/pg_xlogdump/compat.c b/contrib/pg_xlogdump/compat.c
index 6ca7012fd9..3f68db7fdf 100644
--- a/contrib/pg_xlogdump/compat.c
+++ b/contrib/pg_xlogdump/compat.c
@@ -64,9 +64,10 @@ timestamptz_to_str(TimestampTz dt)
     strftime(zone, sizeof(zone), "%Z", ltime);
 
 #ifdef HAVE_INT64_TIMESTAMP
-    sprintf(buf, "%s.%06d %s", ts, (int) (dt % USECS_PER_SEC), zone);
+    snprintf(buf, sizeof(buf), "%s.%06d %s",
+             ts, (int) (dt % USECS_PER_SEC), zone);
 #else
-    sprintf(buf, "%s.%.6f %s", ts, fabs(dt - floor(dt)), zone);
+    snprintf(buf, sizeof(buf), "%s.%.6f %s", ts, fabs(dt - floor(dt)), zone);
 #endif
 
     return buf;
diff --git a/src/backend/catalog/storage.c b/src/backend/catalog/storage.c
index 0fc48dc542..c183800c63 100644
--- a/src/backend/catalog/storage.c
+++ b/src/backend/catalog/storage.c
@@ -64,7 +64,7 @@ typedef struct PendingRelDelete
 
 /*
  * This might look silly, but this is intended to unify the back-patched code
- * with other versions.
+ * against the master branch.
  */
 typedef struct pendingSync
 {
diff --git a/src/bin/pg_xlogdump/compat.c b/src/bin/pg_xlogdump/compat.c
index 845c2e5234..165c2ae544 100644
--- a/src/bin/pg_xlogdump/compat.c
+++ b/src/bin/pg_xlogdump/compat.c
@@ -64,9 +64,10 @@ timestamptz_to_str(TimestampTz dt)
     strftime(zone, sizeof(zone), "%Z", ltime);
 
 #ifdef HAVE_INT64_TIMESTAMP
-    sprintf(buf, "%s.%06d %s", ts, (int) (dt % USECS_PER_SEC), zone);
+    snprintf(buf, sizeof(buf), "%s.%06d %s",
+             ts, (int) (dt % USECS_PER_SEC), zone);
 #else
-    sprintf(buf, "%s.%.6f %s", ts, fabs(dt - floor(dt)), zone);
+    snprintf(buf, sizeof(buf), "%s.%.6f %s", ts, fabs(dt - floor(dt)), zone);
 #endif
 
     return buf;

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Index Skip Scan
Next
From: Alexander Korotkov
Date:
Subject: Re: Psql patch to show access methods info