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