delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/07/07/22:22:39

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <42CDE346.30908@byu.net>
Date: Thu, 07 Jul 2005 20:21:58 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
MIME-Version: 1.0
To: bug-bash AT gnu DOT org
CC: cygwin AT cygwin DOT com
Subject: Broken parse on `'${'`
X-IsSubscribed: yes

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686'
- -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc'
- -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL
- -DHAVE_CONFIG_H -DRECYCLES_PIDS  -I.  -I. -I./include -I./lib   -g -O2
uname output: CYGWIN_NT-5.1 LOUNGE 1.5.18(0.132/4/2) 2005-07-02 20:30 i686
unknown unknown Cygwin
Machine Type: i686-pc-cygwin

Bash Version: 3.0
Patch Level: 16
Release Status: release

Description:
    POSIX requires (XCU 2.3 step 5) that when starting a back-tick command
substitution, that the "shell shall read sufficient input to determine the
end of the unit to be expanded (as explained in the cited sections). While
processing the characters, if instances of expansions or quoting are found
nested within the substitution, the shell shall recursively process them
in the manner specified for the construct that is found."  And for
back-tick command substitution, it requires (XCU 2.6.3 paragraph 3) that
the "search for the matching backquote shall be satisfied by the first
backquote found without a preceding backslash".  From there, it requires
(XCU 2.2.2) that there are no special characters within a single-quote.

Therefore, in the scenario below, the shell should start parsing a command
substitution at the first `, recognize that the first ' starts a
single-quote, recursively parse to the second ', then conclude the command
substitution at the second `, since there are no backslashes in the ``
pair.  After the word is parsed, it should then execute the command "echo
'${'", and feed the output ${ to the outer echo.  zsh 4.2.4 gets this
correct, but bash 2.05b and 3.0 fail.

Repeat-By:
zsh$ echo `echo '${'`
${
zsh$ bash
bash$ echo `echo '${'`
>
# Hmm - I was just incorrectly presented PS2, asking to try to continue
what bash thought was an incomplete ${ variable substitution

Fix:
   unknown

- --
Life is short - so eat dessert first!

Eric Blake             ebb9 AT byu DOT net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCzeNG84KuGfSFAYARAoJ5AKCzUl8XpG5HJlv+OzLX2QbehwHZ9wCgnvRZ
YLId1YfUwgKZAZ06SkKROiE=
=NkSI
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019