From 143732d6082f5cdf036f780f6e0de87f5adab5a3 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Jul 26 2019 16:46:57 +0000 Subject: Resolves: #1722703 - make failed searches of history in Zle robust --- diff --git a/0001-zsh-5.7.1-zle-history-avoid-crash.patch b/0001-zsh-5.7.1-zle-history-avoid-crash.patch new file mode 100644 index 0000000..23932c3 --- /dev/null +++ b/0001-zsh-5.7.1-zle-history-avoid-crash.patch @@ -0,0 +1,92 @@ +From 15c190164c375cfe1772ebec92b544ca26a60e28 Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Tue, 23 Jul 2019 14:45:48 +0200 +Subject: [PATCH 1/2] 44566: make sure Zle doesn't crash if history entry not + found + +Upstream-commit: f9cd2187875b6f2ebdb9b9a787fac20b2aaf745b +Signed-off-by: Kamil Dudka +--- + Src/Zle/zle_utils.c | 14 ++++++++++++-- + 1 file changed, 12 insertions(+), 2 deletions(-) + +diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c +index c6df3d8..633f593 100644 +--- a/Src/Zle/zle_utils.c ++++ b/Src/Zle/zle_utils.c +@@ -1607,7 +1607,12 @@ static int + unapplychange(struct change *ch) + { + if(ch->hist != histline) { +- zle_setline(quietgethist(ch->hist)); ++ Histent he = quietgethist(ch->hist); ++ if(!he) { ++ dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); ++ return 1; ++ } ++ zle_setline(he); + zlecs = ch->new_cs; + return 0; + } +@@ -1647,7 +1652,12 @@ static int + applychange(struct change *ch) + { + if(ch->hist != histline) { +- zle_setline(quietgethist(ch->hist)); ++ Histent he = quietgethist(ch->hist); ++ if(!he) { ++ dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); ++ return 1; ++ } ++ zle_setline(he); + zlecs = ch->old_cs; + return 0; + } +-- +2.20.1 + + +From 10dedc96ce0de43372add239f8256e259ca1e04a Mon Sep 17 00:00:00 2001 +From: Kamil Dudka +Date: Fri, 26 Jul 2019 17:24:59 +0200 +Subject: [PATCH 2/2] 44582: Fix foregoing commit to use DPUTS() better + +Upstream-commit: d6a9e222ec6b006c09d6f84beae6ef488a19b214 +Signed-off-by: Kamil Dudka +--- + Src/Zle/zle_utils.c | 10 ++++------ + 1 file changed, 4 insertions(+), 6 deletions(-) + +diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c +index 633f593..29dba08 100644 +--- a/Src/Zle/zle_utils.c ++++ b/Src/Zle/zle_utils.c +@@ -1608,10 +1608,9 @@ unapplychange(struct change *ch) + { + if(ch->hist != histline) { + Histent he = quietgethist(ch->hist); +- if(!he) { +- dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); ++ DPUTS(he == NULL, "quietgethist(ch->hist) returned NULL"); ++ if(he == NULL) + return 1; +- } + zle_setline(he); + zlecs = ch->new_cs; + return 0; +@@ -1653,10 +1652,9 @@ applychange(struct change *ch) + { + if(ch->hist != histline) { + Histent he = quietgethist(ch->hist); +- if(!he) { +- dputs(ERRMSG("quietgethist(ch->hist) returned NULL")); ++ DPUTS(he == NULL, "quietgethist(ch->hist) returned NULL"); ++ if(he == NULL) + return 1; +- } + zle_setline(he); + zlecs = ch->old_cs; + return 0; +-- +2.20.1 + diff --git a/zsh.spec b/zsh.spec index 8aa1eb5..0d77f70 100644 --- a/zsh.spec +++ b/zsh.spec @@ -1,7 +1,7 @@ Summary: Powerful interactive shell Name: zsh Version: 5.7.1 -Release: 3%{?dist} +Release: 4%{?dist} License: MIT URL: http://zsh.sourceforge.net/ Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz @@ -12,6 +12,9 @@ Source4: zshrc.rhs Source5: zshenv.rhs Source6: dotzshrc +# make failed searches of history in Zle robust (#1722703) +Patch1: 0001-zsh-5.7.1-zle-history-avoid-crash.patch + BuildRequires: autoconf BuildRequires: coreutils BuildRequires: gawk @@ -154,6 +157,9 @@ fi %doc Doc/*.html %changelog +* Fri Jul 26 2019 Kamil Dudka - 5.7.1-4 +- make failed searches of history in Zle robust (#1722703) + * Tue Mar 12 2019 Kamil Dudka - 5.7.1-3 - avoid build failure in case we have working ypcat (#1687574)