fix handling of command substitution in math context

This commit is contained in:
Kamil Dudka 2015-07-30 17:46:51 +02:00
parent daebc620a0
commit b8ecd5913f
2 changed files with 62 additions and 1 deletions

54
zsh-5.0.8-cmd-subst.patch Normal file
View File

@ -0,0 +1,54 @@
From 7cde13f288c79c9b3d3b2274e7b3dc1f08ee6eeb Mon Sep 17 00:00:00 2001
From: "Barton E. Schaefer" <schaefer@zsh.org>
Date: Wed, 29 Jul 2015 22:36:45 -0700
Subject: [PATCH] 35953: fix handling of command substitution in math context
Upstream-commit: c0a80171ee615b52a15a6fc8efe83c2bb53451d2
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
---
Src/lex.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/Src/lex.c b/Src/lex.c
index 841fb0b..8710f75 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -1387,7 +1387,7 @@ dquote_parse(char endchar, int sub)
{
int pct = 0, brct = 0, bct = 0, intick = 0, err = 0;
int c;
- int math = endchar == ')' || endchar == ']';
+ int math = endchar == ')' || endchar == ']' || infor;
int zlemath = math && zlemetacs > zlemetall + addedx - inbufct;
while (((c = hgetc()) != endchar || bct ||
@@ -1994,8 +1994,10 @@ skipcomm(void)
#else
char *new_tokstr;
int new_lexstop, new_lex_add_raw;
+ int save_infor = infor;
struct lexbufstate new_lexbuf;
+ infor = 0;
cmdpush(CS_CMDSUBST);
SETPARBEGIN
add(Inpar);
@@ -2052,6 +2054,7 @@ skipcomm(void)
* the recursive parsing.
*/
lexflags &= ~LEXFLAGS_ZLE;
+ dbparens = 0; /* restored by zcontext_restore_partial() */
if (!parse_event(OUTPAR) || tok != OUTPAR)
lexstop = 1;
@@ -2098,6 +2101,7 @@ skipcomm(void)
if (!lexstop)
SETPAREND
cmdpop();
+ infor = save_infor;
return lexstop;
#endif
--
2.4.6

View File

@ -3,7 +3,7 @@
Summary: Powerful interactive shell
Name: zsh
Version: 5.0.8
Release: 5%{?dist}
Release: 6%{?dist}
License: MIT
URL: http://zsh.sourceforge.net/
Group: System Environment/Shells
@ -30,6 +30,9 @@ Patch4: zsh-5.0.8-comp-dnf.patch
# prevent infinite recursion in ihungetc() (#1245712)
Patch5: zsh-5.0.8-hist-bz1245712.patch
# fix handling of command substitution in math context
Patch6: zsh-5.0.8-cmd-subst.patch
BuildRequires: coreutils sed ncurses-devel libcap-devel
BuildRequires: texinfo texi2html gawk hostname
Requires(post): info grep
@ -69,6 +72,7 @@ This package contains the Zsh manual in html format.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
cp -p %SOURCE7 .
@ -186,6 +190,9 @@ fi
%doc Doc/*.html
%changelog
* Thu Jul 30 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-6
- fix handling of command substitution in math context
* Wed Jul 22 2015 Kamil Dudka <kdudka@redhat.com> - 5.0.8-5
- prevent infinite recursion in ihungetc() (#1245712)