bb9a7e
From b72f88db852104cf49cfb4762eda6e8f4fd20a70 Mon Sep 17 00:00:00 2001
bb9a7e
From: Chet Ramey <chet.ramey@case.edu>
bb9a7e
Date: Tue, 4 May 2021 14:31:05 -0400
bb9a7e
Subject: [PATCH] Bash-5.1 patch 7: fix version comparisons in readline startup
bb9a7e
 files
bb9a7e
bb9a7e
---
bb9a7e
 lib/readline/bind.c | 15 ++++++++-------
bb9a7e
 patchlevel.h        |  2 +-
bb9a7e
 2 files changed, 9 insertions(+), 8 deletions(-)
bb9a7e
bb9a7e
diff --git a/lib/readline/bind.c b/lib/readline/bind.c
bb9a7e
index 87596dce..76103786 100644
bb9a7e
--- a/lib/readline/bind.c
bb9a7e
+++ b/lib/readline/bind.c
bb9a7e
@@ -1234,7 +1234,7 @@ parser_if (char *args)
bb9a7e
 #endif /* VI_MODE */
bb9a7e
   else if (_rl_strnicmp (args, "version", 7) == 0)
bb9a7e
     {
bb9a7e
-      int rlversion, versionarg, op, previ, major, minor;
bb9a7e
+      int rlversion, versionarg, op, previ, major, minor, opresult;
bb9a7e
 
bb9a7e
       _rl_parsing_conditionalized_out = 1;
bb9a7e
       rlversion = RL_VERSION_MAJOR*10 + RL_VERSION_MINOR;
bb9a7e
@@ -1294,24 +1294,25 @@ parser_if (char *args)
bb9a7e
       switch (op)
bb9a7e
 	{
bb9a7e
 	case OP_EQ:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion == versionarg;
bb9a7e
+ 	  opresult = rlversion == versionarg;
bb9a7e
 	  break;
bb9a7e
 	case OP_NE:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion != versionarg;
bb9a7e
+	  opresult = rlversion != versionarg;
bb9a7e
 	  break;
bb9a7e
 	case OP_GT:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion > versionarg;
bb9a7e
+	  opresult = rlversion > versionarg;
bb9a7e
 	  break;
bb9a7e
 	case OP_GE:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion >= versionarg;
bb9a7e
+	  opresult = rlversion >= versionarg;
bb9a7e
 	  break;
bb9a7e
 	case OP_LT:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion < versionarg;
bb9a7e
+	  opresult = rlversion < versionarg;
bb9a7e
 	  break;
bb9a7e
 	case OP_LE:
bb9a7e
-	  _rl_parsing_conditionalized_out = rlversion <= versionarg;
bb9a7e
+	  opresult = rlversion <= versionarg;
bb9a7e
 	  break;
bb9a7e
 	}
bb9a7e
+      _rl_parsing_conditionalized_out = 1 - opresult;
bb9a7e
     }
bb9a7e
   /* Check to see if the first word in ARGS is the same as the
bb9a7e
      value stored in rl_readline_name. */
bb9a7e
diff --git a/patchlevel.h b/patchlevel.h
bb9a7e
index 6257aeeb..c5ed66ab 100644
bb9a7e
--- a/patchlevel.h
bb9a7e
+++ b/patchlevel.h
bb9a7e
@@ -25,6 +25,6 @@
bb9a7e
    regexp `^#define[ 	]*PATCHLEVEL', since that's what support/mkversion.sh
bb9a7e
    looks for to find the patch level (for the sccs version string). */
bb9a7e
 
bb9a7e
-#define PATCHLEVEL 6
bb9a7e
+#define PATCHLEVEL 7
bb9a7e
 
bb9a7e
 #endif /* _PATCHLEVEL_H_ */
bb9a7e
-- 
bb9a7e
2.29.2
bb9a7e