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