RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1338689 - zsh exits with "parse error near `!'" for script with unescaped ! character
Summary: zsh exits with "parse error near `!'" for script with unescaped ! character
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: zsh
Version: 7.2
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Kamil Dudka
QA Contact: Jan Kepler
Maxim Svistunov
URL:
Whiteboard:
Depends On:
Blocks: 1339601
TreeView+ depends on / blocked
 
Reported: 2016-05-23 09:37 UTC by Tim Speetjens
Modified: 2019-11-14 08:07 UTC (History)
2 users (show)

Fixed In Version: zsh-5.0.2-23.el7
Doc Type: Bug Fix
Doc Text:
*zsh* parses unescaped exclamation marks correctly now Previously, *zsh* parser state was insufficiently initialized. Consequently, *zsh* failed to parse unescaped exclamation marks in a text string. With this update, *zsh* properly initializes the parser state. As a result, *zsh* now parses unescaped exclamation marks correctly.
Clone Of:
: 1339601 (view as bug list)
Environment:
Last Closed: 2016-11-03 23:03:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
[PATCH 2/7] Resolves: #1338689 - better initialize parser state (2.03 KB, patch)
2016-05-23 15:25 UTC, Kamil Dudka
kdudka: review?
Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2152 0 normal SHIPPED_LIVE zsh bug fix update 2016-11-03 13:13:01 UTC

Description Tim Speetjens 2016-05-23 09:37:06 UTC
Description of problem:
zsh exits with "parse error near `!'" for script with unescaped ! character

Version-Release number of selected component (if applicable):
zsh-5.0.2-19.el7.x86_64

How reproducible:
100%

Steps to Reproduce:

$ cat simple.ksh 
#!/bin/ksh

if [[ -z $(echo !) ]]; then
  echo this does not happen
else
  echo ok
fi

$ zsh simple.ksh
simple.ksh:3: parse error near `!'
simple.ksh:4: parse error near `$(echo !) ]]; then'

with ksh linked to zsh, to invoke zsh in posix mode:
$ ksh simple.ksh
simple.ksh:3: parse error near `!'
simple.ksh:4: parse error near `$(echo !) ]]; then'


Actual results:
Script exits with error: parse error near `!'

Expected results:
Script runs fine

Additional info:

Affected:
zsh version 5.0.2-19.el7

Ok:
zsh up until and including 5.0.2-14.el7,
zsh-5.0.8-8.fc22.x86_64 in fedora22

This issue seems to be limited to the $( ) notation, as the following script runs fine:
$ cat simple-ok.ksh 
#!/bin/ksh

if [[ -z `echo !` ]]; then
  echo this does not happen
else
  echo ok
fi

Also AT&T ksh runs this script fine.

Comment 2 Kamil Dudka 2016-05-23 13:54:39 UTC
This seems to be yet another regression introduced by the fix for bug #1241023.  git-bisect points to the following (non-trivial) upstream commit as the fix for this bug:

https://sourceforge.net/p/zsh/code/ci/cfd91eac

Comment 4 Kamil Dudka 2016-05-23 15:25:55 UTC
Created attachment 1160672 [details]
[PATCH 2/7] Resolves: #1338689 - better initialize parser state

This fix is isolated out from a huge upstream commit that includes major
code refactoring changes together with the initialization fix actually
needed to resolve #1338689.

Comment 12 errata-xmlrpc 2016-11-03 23:03:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2152.html


Note You need to log in before you can comment on or make changes to this bug.