diff --git a/0003-zsh-5.5.1-parse-error-exit-status.patch b/0003-zsh-5.5.1-parse-error-exit-status.patch
new file mode 100644
index 0000000..6605665
--- /dev/null
+++ b/0003-zsh-5.5.1-parse-error-exit-status.patch
@@ -0,0 +1,28 @@
+From 878ebe3c74cee4b9702c9672b87ee56f057e1f02 Mon Sep 17 00:00:00 2001
+From: Peter Stephenson
+Date: Thu, 29 Nov 2018 17:54:02 +0000
+Subject: [PATCH] 43854: Set tok to LEXERR on generic parse error.
+
+Needed by main loop which detects an error this way.
+
+Upstream-commit: ef20425381e83ebd5a10c2ab270a347018371162
+Signed-off-by: Kamil Dudka
+---
+ Src/lex.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/Src/lex.c b/Src/lex.c
+index 44ad880..c29aaba 100644
+--- a/Src/lex.c
++++ b/Src/lex.c
+@@ -1613,6 +1613,7 @@ parsestr(char **s)
+ zerr("parse error near `%c'", err);
+ else
+ zerr("parse error");
++ tok = LEXERR;
+ }
+ }
+ return err;
+--
+2.17.2
+
diff --git a/zsh.spec b/zsh.spec
index c9c07e7..163ba40 100644
--- a/zsh.spec
+++ b/zsh.spec
@@ -1,7 +1,7 @@
Summary: Powerful interactive shell
Name: zsh
Version: 5.6.2
-Release: 2%{?dist}
+Release: 3%{?dist}
License: MIT
URL: http://zsh.sourceforge.net/
Source0: https://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.xz
@@ -15,6 +15,9 @@ Source6: dotzshrc
# fix programming mistakes detected by static analysis
Patch2: 0002-zsh-5.5.1-static-analysis.patch
+# return non-zero exit status on nested parse error (#1654989)
+Patch3: 0003-zsh-5.5.1-parse-error-exit-status.patch
+
BuildRequires: autoconf
BuildRequires: coreutils
BuildRequires: gawk
@@ -170,6 +173,9 @@ fi
%doc Doc/*.html
%changelog
+* Fri Nov 30 2018 Kamil Dudka - 5.6.2-3
+- return non-zero exit status on nested parse error (#1654989)
+
* Mon Nov 12 2018 Kamil Dudka - 5.6.2-2
- fix programming mistakes detected by static analysis