Fix handling case statement in command subsitution

Resolves: #1556867
This commit is contained in:
Siteshwar Vashisht 2018-03-15 14:05:15 +01:00
parent c98f4804e3
commit f379fd1f6a
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,18 @@
diff --git a/parse.y b/parse.y
--- a/parse.y
+++ b/parse.y
@@ -4011,11 +4011,13 @@ eof_error:
tflags |= LEX_RESWDOK;
lex_rwlen = 0;
}
- else
+ else if (shellmeta (ch) == 0)
{
tflags &= ~LEX_RESWDOK;
/*itrace("parse_comsub:%d: found `%.4s', lex_reswdok -> 0", line_number, ret+retind-4);*/
}
+ else /* can't be in a reserved word any more */
+ lex_rwlen = 0;
}
else if MBTEST((tflags & LEX_CKCOMMENT) && ch == '#' && (lex_rwlen == 0 || ((tflags & LEX_INWORD) && lex_wlen == 0)))
; /* don't modify LEX_RESWDOK if we're starting a comment */

View File

@ -7,7 +7,7 @@
Version: %{baseversion}%{patchleveltag}
Name: bash
Summary: The GNU Bourne Again shell
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv3+
Url: https://www.gnu.org/software/bash
Source0: https://ftp.gnu.org/gnu/bash/bash-%{baseversion}.tar.gz
@ -89,6 +89,10 @@ Patch129: bash-4.4-assignment-error.patch
# This should be dropped while rebasing to bash-4.5
Patch130: bash-4.5-test-modification-time.patch
# 1556867 - case in a for loop inside subshell causes syntax error
# This should be dropped while rebasing to bash-4.5
Patch131: bash-4.4-case-in-command-subst.patch
BuildRequires: texinfo bison
BuildRequires: ncurses-devel
BuildRequires: autoconf, gettext
@ -312,6 +316,10 @@ end
%{_libdir}/pkgconfig/%{name}.pc
%changelog
* Thu Mar 15 2018 Siteshwar Vashisht <svashisht@redhat.com> - 4.4.19-2
- Fix handling case statement in command subsitution
Resolves: #1556867
* Mon Feb 12 2018 Siteshwar Vashisht <svashisht@redhat.com> - 4.4.19-1
- Update to bash-4.4 patchlevel 19
Resolves: #1540383