On Sat, Sep 3, 2022 at 4:04 AM Andres Freund <and...@anarazel.de> wrote:
> On 2022-09-02 16:29:22 -0400, Tom Lane wrote:
> > Andres Freund <and...@anarazel.de> writes:
> > > On 2022-09-02 15:08:01 -0400, Tom Lane wrote:
> > I'd be content for now to set the minimums at 2.3 and 2.5.35.
>
> +1

Here are autoconf-only patches to that effect.

-- 
John Naylor
EDB: http://www.enterprisedb.com
From 5e07442ebf728c486536038aecf29aefcc892455 Mon Sep 17 00:00:00 2001
From: John Naylor <john.nay...@postgresql.org>
Date: Tue, 6 Sep 2022 11:41:58 +0700
Subject: [PATCH v2 2/2] Bump minimum version of Flex to 2.5.35

Since the retirement of some older buildfarm members, the oldest Bison
that gets regular testing is 2.5.35.

Discussion: https://www.postgresql.org/message-id/1097762.1662145...@sss.pgh.pa.us
---
 config/programs.m4                | 10 ++++------
 configure                         |  6 +++---
 doc/src/sgml/install-windows.sgml |  2 +-
 doc/src/sgml/installation.sgml    |  2 +-
 src/backend/utils/misc/guc-file.l |  4 ++--
 src/tools/msvc/pgflex.pl          |  2 +-
 6 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/config/programs.m4 b/config/programs.m4
index bcdfbc3a51..ce83155592 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -65,10 +65,8 @@ AC_SUBST(BISONFLAGS)
 # PGAC_PATH_FLEX
 # --------------
 # Look for Flex, set the output variable FLEX to its path if found.
-# Reject versions before 2.5.31, as we need a reasonably non-buggy reentrant
-# scanner.  (Note: the well-publicized security problem in 2.5.31 does not
-# affect Postgres, and there are still distros shipping patched 2.5.31,
-# so allow it.)  Also find Flex if its installed under `lex', but do not
+# Reject versions before 2.5.35 (the earliest version in the buildfarm
+# as of 2022). Also find Flex if its installed under `lex', but do not
 # accept other Lex programs.
 
 AC_DEFUN([PGAC_PATH_FLEX],
@@ -92,14 +90,14 @@ else
         echo '%%'  > conftest.l
         if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
           pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
-          if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 == 2 && ([$]2 > 5 || ([$]2 == 5 && [$]3 >= 31))) exit 0; else exit 1;}'
+          if echo "$pgac_flex_version" | sed ['s/[.a-z]/ /g'] | $AWK '{ if ([$]1 == 2 && ([$]2 > 5 || ([$]2 == 5 && [$]3 >= 35))) exit 0; else exit 1;}'
           then
             pgac_cv_path_flex=$pgac_candidate
             break 2
           else
             AC_MSG_WARN([
 *** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version.])
+*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version.])
           fi
         fi
       fi
diff --git a/configure b/configure
index 4a725ab205..613c385c48 100755
--- a/configure
+++ b/configure
@@ -10278,17 +10278,17 @@ else
         echo '%%'  > conftest.l
         if $pgac_candidate -t conftest.l 2>/dev/null | grep FLEX_SCANNER >/dev/null 2>&1; then
           pgac_flex_version=`$pgac_candidate --version 2>/dev/null`
-          if echo "$pgac_flex_version" | sed 's/[.a-z]/ /g' | $AWK '{ if ($1 == 2 && ($2 > 5 || ($2 == 5 && $3 >= 31))) exit 0; else exit 1;}'
+          if echo "$pgac_flex_version" | sed 's/[.a-z]/ /g' | $AWK '{ if ($1 == 2 && ($2 > 5 || ($2 == 5 && $3 >= 35))) exit 0; else exit 1;}'
           then
             pgac_cv_path_flex=$pgac_candidate
             break 2
           else
             { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
 *** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version." >&5
+*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&5
 $as_echo "$as_me: WARNING:
 *** The installed version of Flex, $pgac_candidate, is too old to use with PostgreSQL.
-*** Flex version 2.5.31 or later is required, but this is $pgac_flex_version." >&2;}
+*** Flex version 2.5.35 or later is required, but this is $pgac_flex_version." >&2;}
           fi
         fi
       fi
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index 499fd59bf0..c00ab2b4b2 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -220,7 +220,7 @@ $ENV{MSBFLAGS}="/m";
       <productname>Bison</productname> and <productname>Flex</productname> are
       required to build from Git, but not required when building from a release
       file. Only <productname>Bison</productname> versions 2.3 and later
-      will work. <productname>Flex</productname> must be version 2.5.31 or later.
+      will work. <productname>Flex</productname> must be version 2.5.35 or later.
      </para>
 
      <para>
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 7f7f8428e1..9daa656a04 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -314,7 +314,7 @@ su - postgres
       <application>Flex</application> and <application>Bison</application>
       are needed to build from a Git checkout, or if you changed the actual
       scanner and parser definition files. If you need them, be sure
-      to get <application>Flex</application> 2.5.31 or later and
+      to get <application>Flex</application> 2.5.35 or later and
       <application>Bison</application> 2.3 or later. Other <application>lex</application>
       and <application>yacc</application> programs cannot be used.
      </para>
diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index 4f43430db4..721628c0cf 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -332,8 +332,8 @@ record_config_file_error(const char *errmsg,
 /*
  * Flex fatal errors bring us here.  Stash the error message and jump back to
  * ParseConfigFp().  Assume all msg arguments point to string constants; this
- * holds for flex 2.5.31 (earliest we support) and flex 2.5.35 (latest as of
- * this writing).  Otherwise, we would need to copy the message.
+ * holds for flex 2.5.35 (earliest we support). Otherwise, we would need to
+ * copy the message.
  *
  * We return "int" since this takes the place of calls to fprintf().
 */
diff --git a/src/tools/msvc/pgflex.pl b/src/tools/msvc/pgflex.pl
index eb3198381f..b62478b9f5 100644
--- a/src/tools/msvc/pgflex.pl
+++ b/src/tools/msvc/pgflex.pl
@@ -21,7 +21,7 @@ $flexver = (split(/\s+/, $flexver))[1];
 $flexver =~ s/[^0-9.]//g;
 my @verparts = split(/\./, $flexver);
 unless ($verparts[0] == 2
-	&& ($verparts[1] > 5 || ($verparts[1] == 5 && $verparts[2] >= 31)))
+	&& ($verparts[1] > 5 || ($verparts[1] == 5 && $verparts[2] >= 35)))
 {
 	print "WARNING! Flex install not found, or unsupported Flex version.\n";
 	print "echo Attempting to build without.\n";
-- 
2.36.1

From b7f35ae5e0fd55f8dceb2a4a546be3b50065a09c Mon Sep 17 00:00:00 2001
From: John Naylor <john.nay...@postgresql.org>
Date: Tue, 6 Sep 2022 11:41:58 +0700
Subject: [PATCH v2 1/2] Bump minimum version of Bison to 2.3

Since the retirement of some older buildfarm members, the oldest Bison
that gets regular testing is 2.3. MacOS ships that version, and will
continue doing so for the forseeable future because of Apple's policy
regarding GPLv3. While Mac users could use a package manager to install
a newer version, there is no compelling reason to do so at this time.

Discussion: https://www.postgresql.org/message-id/1097762.1662145...@sss.pgh.pa.us
---
 config/programs.m4                     | 8 ++++----
 configure                              | 6 +++---
 contrib/cube/cubeparse.y               | 5 +----
 contrib/seg/segparse.y                 | 5 +----
 doc/src/sgml/install-windows.sgml      | 2 +-
 doc/src/sgml/installation.sgml         | 2 +-
 src/backend/bootstrap/bootparse.y      | 5 +----
 src/backend/parser/gram.y              | 5 +----
 src/backend/replication/repl_gram.y    | 5 +----
 src/backend/replication/syncrep_gram.y | 5 +----
 src/backend/utils/adt/jsonpath_gram.y  | 5 +----
 src/pl/plpgsql/src/pl_gram.y           | 5 +----
 src/tools/msvc/pgbison.pl              | 2 +-
 13 files changed, 18 insertions(+), 42 deletions(-)

diff --git a/config/programs.m4 b/config/programs.m4
index e7908d8793..bcdfbc3a51 100644
--- a/config/programs.m4
+++ b/config/programs.m4
@@ -22,8 +22,8 @@ fi
 # PGAC_PATH_BISON
 # ---------------
 # Look for Bison, set the output variable BISON to its path if found.
-# Reject versions before 1.875 (they have bugs or capacity limits).
-# Note we do not accept other implementations of yacc.
+# Reject versions before 2.3 (the earliest version in the buildfarm
+# as of 2022). Note we do not accept other implementations of yacc.
 
 AC_DEFUN([PGAC_PATH_BISON],
 [PGAC_PATH_PROGS(BISON, bison)
@@ -31,11 +31,11 @@ AC_DEFUN([PGAC_PATH_BISON],
 if test "$BISON"; then
   pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
   AC_MSG_NOTICE([using $pgac_bison_version])
-  if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 1.875) exit 0; else exit 1;}'
+  if echo "$pgac_bison_version" | $AWK '{ if ([$]4 < 2.3) exit 0; else exit 1;}'
   then
     AC_MSG_WARN([
 *** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
-*** Bison version 1.875 or later is required, but this is $pgac_bison_version.])
+*** Bison version 2.3 or later is required, but this is $pgac_bison_version.])
     BISON=""
   fi
   # Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
diff --git a/configure b/configure
index a268780c5d..4a725ab205 100755
--- a/configure
+++ b/configure
@@ -10218,14 +10218,14 @@ if test "$BISON"; then
   pgac_bison_version=`$BISON --version 2>/dev/null | sed q`
   { $as_echo "$as_me:${as_lineno-$LINENO}: using $pgac_bison_version" >&5
 $as_echo "$as_me: using $pgac_bison_version" >&6;}
-  if echo "$pgac_bison_version" | $AWK '{ if ($4 < 1.875) exit 0; else exit 1;}'
+  if echo "$pgac_bison_version" | $AWK '{ if ($4 < 2.3) exit 0; else exit 1;}'
   then
     { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
 *** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
-*** Bison version 1.875 or later is required, but this is $pgac_bison_version." >&5
+*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&5
 $as_echo "$as_me: WARNING:
 *** The installed version of Bison, $BISON, is too old to use with PostgreSQL.
-*** Bison version 1.875 or later is required, but this is $pgac_bison_version." >&2;}
+*** Bison version 2.3 or later is required, but this is $pgac_bison_version." >&2;}
     BISON=""
   fi
   # Bison >=3.0 issues warnings about %name-prefix="base_yy", instead
diff --git a/contrib/cube/cubeparse.y b/contrib/cube/cubeparse.y
index 6cceae8e99..977dcba965 100644
--- a/contrib/cube/cubeparse.y
+++ b/contrib/cube/cubeparse.y
@@ -15,10 +15,7 @@
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/contrib/seg/segparse.y b/contrib/seg/segparse.y
index 637eacd1a6..1d2adbbec8 100644
--- a/contrib/seg/segparse.y
+++ b/contrib/seg/segparse.y
@@ -13,10 +13,7 @@
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/doc/src/sgml/install-windows.sgml b/doc/src/sgml/install-windows.sgml
index 11e153578c..499fd59bf0 100644
--- a/doc/src/sgml/install-windows.sgml
+++ b/doc/src/sgml/install-windows.sgml
@@ -219,7 +219,7 @@ $ENV{MSBFLAGS}="/m";
      <para>
       <productname>Bison</productname> and <productname>Flex</productname> are
       required to build from Git, but not required when building from a release
-      file. Only <productname>Bison</productname> 1.875 or versions 2.2 and later
+      file. Only <productname>Bison</productname> versions 2.3 and later
       will work. <productname>Flex</productname> must be version 2.5.31 or later.
      </para>
 
diff --git a/doc/src/sgml/installation.sgml b/doc/src/sgml/installation.sgml
index 70d188e2bc..7f7f8428e1 100644
--- a/doc/src/sgml/installation.sgml
+++ b/doc/src/sgml/installation.sgml
@@ -315,7 +315,7 @@ su - postgres
       are needed to build from a Git checkout, or if you changed the actual
       scanner and parser definition files. If you need them, be sure
       to get <application>Flex</application> 2.5.31 or later and
-      <application>Bison</application> 1.875 or later. Other <application>lex</application>
+      <application>Bison</application> 2.3 or later. Other <application>lex</application>
       and <application>yacc</application> programs cannot be used.
      </para>
     </listitem>
diff --git a/src/backend/bootstrap/bootparse.y b/src/backend/bootstrap/bootparse.y
index c45ddde67f..e6d62d81c1 100644
--- a/src/backend/bootstrap/bootparse.y
+++ b/src/backend/bootstrap/bootparse.y
@@ -36,10 +36,7 @@
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 0492ff9a66..ea33784316 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -103,10 +103,7 @@
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y
index b343f108d3..8ff6ab362f 100644
--- a/src/backend/replication/repl_gram.y
+++ b/src/backend/replication/repl_gram.y
@@ -29,10 +29,7 @@ Node *replication_parse_result;
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/backend/replication/syncrep_gram.y b/src/backend/replication/syncrep_gram.y
index 4fc3647da1..c18ddb2e9b 100644
--- a/src/backend/replication/syncrep_gram.y
+++ b/src/backend/replication/syncrep_gram.y
@@ -26,10 +26,7 @@ static SyncRepConfigData *create_syncrep_config(const char *num_sync,
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/backend/utils/adt/jsonpath_gram.y b/src/backend/utils/adt/jsonpath_gram.y
index 35a79ca965..7e28853a57 100644
--- a/src/backend/utils/adt/jsonpath_gram.y
+++ b/src/backend/utils/adt/jsonpath_gram.y
@@ -45,10 +45,7 @@ static JsonPathParseItem *makeItemLikeRegex(JsonPathParseItem *expr,
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/pl/plpgsql/src/pl_gram.y b/src/pl/plpgsql/src/pl_gram.y
index 0b8aea9504..f7cf2b4b89 100644
--- a/src/pl/plpgsql/src/pl_gram.y
+++ b/src/pl/plpgsql/src/pl_gram.y
@@ -39,10 +39,7 @@
 /*
  * Bison doesn't allocate anything that needs to live across parser calls,
  * so we can easily have it use palloc instead of malloc.  This prevents
- * memory leaks if we error out during parsing.  Note this only works with
- * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
- * if possible, so there's not really much problem anyhow, at least if
- * you're building with gcc.
+ * memory leaks if we error out during parsing.
  */
 #define YYMALLOC palloc
 #define YYFREE   pfree
diff --git a/src/tools/msvc/pgbison.pl b/src/tools/msvc/pgbison.pl
index 3974c30d96..60935adbaa 100644
--- a/src/tools/msvc/pgbison.pl
+++ b/src/tools/msvc/pgbison.pl
@@ -16,7 +16,7 @@ do './src/tools/msvc/buildenv.pl' if -e 'src/tools/msvc/buildenv.pl';
 my ($bisonver) = `bison -V`;    # grab first line
 $bisonver = (split(/\s+/, $bisonver))[3];    # grab version number
 
-unless ($bisonver eq '1.875' || $bisonver ge '2.2')
+unless ($bisonver ge '2.3')
 {
 	print "WARNING! Bison install not found, or unsupported Bison version.\n";
 	print "echo Attempting to build without.\n";
-- 
2.36.1

Reply via email to