Package init

This commit is contained in:
dogsheng 2019-12-25 16:11:19 +08:00
parent a71fa0cdf6
commit 773fd376c2
2 changed files with 88 additions and 1 deletions

View File

@ -0,0 +1,79 @@
From a531a1ec2dce97c1507a45abd4795b1aea1edc9e Mon Sep 17 00:00:00 2001
From: Oliver Kiddle <okiddle@yahoo.co.uk>
Date: Thu, 23 May 2019 01:05:01 +0200
Subject: [PATCH 225/262] 44345: fix wordcode traversal where ! without a
following command could result in a crash
---
ChangeLog | 5 +++++
Src/text.c | 9 +++++++--
Test/A01grammar.ztst | 33 +++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/Src/text.c b/Src/text.c
index 3658b1bc6..a4191bf1a 100644
--- a/Src/text.c
+++ b/Src/text.c
@@ -470,8 +470,13 @@ gettext2(Estate state)
" || " : " && ");
s->code = *state->pc++;
s->pop = (WC_SUBLIST_TYPE(s->code) == WC_SUBLIST_END);
- if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_NOT)
- taddstr("! ");
+ if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_NOT) {
+ if (WC_SUBLIST_SKIP(s->code) == 0)
+ stack = 1;
+ taddstr((stack || (!(WC_SUBLIST_FLAGS(s->code) &
+ WC_SUBLIST_SIMPLE) && wc_code(*state->pc) !=
+ WC_PIPE)) ? "!" : "! ");
+ }
if (WC_SUBLIST_FLAGS(s->code) & WC_SUBLIST_COPROC)
taddstr("coproc ");
}
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 1ed3cb6b7..c8600d4cb 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -76,6 +76,39 @@
0:Basic current shell list with error
>false
+ fn() { : && ! ; : }
+ functions -x3 fn
+ fn
+0:End of sublist containing ! with no command
+>fn () {
+> : && !
+> :
+>}
+
+ if [[ m -eq y ]]; then
+ : && !
+ :
+ fi
+0:! followed by no further commands
+
+ fn() { ! {!} && ! (!) || ! {!} }
+ functions -x2 fn
+ fn
+0:exclamation marks without following commands
+>fn () {
+> ! {
+> !
+> } && ! (
+> !
+> ) || ! {
+> !
+> }
+>}
+
+ ! | true
+1:! followed by no command but by a pipe
+?(eval):1: parse error near `|'
+
#
# Tests for `Precommand Modifiers'
#
--
2.19.1

View File

@ -2,7 +2,7 @@
Name: zsh Name: zsh
Version: 5.6.2 Version: 5.6.2
Release: 2 Release: 3
Summary: A shell designed for interactive use Summary: A shell designed for interactive use
License: MIT License: MIT
URL: http://zsh.sourceforge.net URL: http://zsh.sourceforge.net
@ -25,6 +25,8 @@ Requires(postun): coreutils grep
Provides: /bin/zsh Provides: /bin/zsh
Patch6000: 0225-44345-fix-wordcode-traversal-where-without-a-followi.patch
%description %description
The zsh is a shell designed for interactive use, and it is also a powerful scripting language. Many of The zsh is a shell designed for interactive use, and it is also a powerful scripting language. Many of
the useful features of bash, ksh, and tcsh were incorporated into zsh. It can match files by file extension the useful features of bash, ksh, and tcsh were incorporated into zsh. It can match files by file extension
@ -127,5 +129,11 @@ fi
%{_datadir}/zsh %{_datadir}/zsh
%changelog %changelog
* Wed Dec 18 2019 jiangchuangang <jiangchuangang@huawei.com> - 5.6.2-3
- Type:enhancement
- ID:NA
- SUG:restart
- DESC:Synchronize a patch
* Wed Sep 18 2019 dongjian <dongjian13@huawei.com> - 5.6.2-2 * Wed Sep 18 2019 dongjian <dongjian13@huawei.com> - 5.6.2-2
- modify summary - modify summary