This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Broken parse on `'${'`


-----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@byu.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]