bash/backport-Bash-5.1-patch-16-fix-interpretation-of-multiple-ins.patch
wangyuhang 40a91259dd back port patches to fix some bug
(cherry picked from commit aab02889f1e2102f8516a065c854996c9bf418d3)
2023-01-17 09:37:06 +08:00

43 lines
1.3 KiB
Diff

From 9439ce094c9aa7557a9d53ac7b412a23aa66e36b Mon Sep 17 00:00:00 2001
From: Chet Ramey <chet.ramey@case.edu>
Date: Tue, 4 Jan 2022 17:03:45 -0500
Subject: [PATCH] Bash-5.1 patch 16: fix interpretation of multiple instances
of ! in [[ conditional commands
Conflict:NA
Reference:https://git.savannah.gnu.org/cgit/bash.git/commit/?id=9439ce094c9aa7557a9d53ac7b412a23aa66e36b
---
parse.y | 2 +-
y.tab.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/parse.y b/parse.y
index f25575b5..f4168c7c 100644
--- a/parse.y
+++ b/parse.y
@@ -4796,7 +4796,7 @@ cond_term ()
dispose_word (yylval.word); /* not needed */
term = cond_term ();
if (term)
- term->flags |= CMD_INVERT_RETURN;
+ term->flags ^= CMD_INVERT_RETURN;
}
else if (tok == WORD && yylval.word->word[0] == '-' && yylval.word->word[1] && yylval.word->word[2] == 0 && test_unop (yylval.word->word))
{
diff --git a/y.tab.c b/y.tab.c
index c11d7aaa..78b38250 100644
--- a/y.tab.c
+++ b/y.tab.c
@@ -7090,7 +7090,7 @@ cond_term ()
dispose_word (yylval.word); /* not needed */
term = cond_term ();
if (term)
- term->flags |= CMD_INVERT_RETURN;
+ term->flags ^= CMD_INVERT_RETURN;
}
else if (tok == WORD && yylval.word->word[0] == '-' && yylval.word->word[1] && yylval.word->word[2] == 0 && test_unop (yylval.word->word))
{
--
2.33.0