From: Eric Blake <eblake@redhat.com>
To: John Lumby <johnlumby@hotmail.com>
Cc: zsh-workers@zsh.org, autoconf maillist <autoconf@gnu.org>,
libtool-patches@gnu.org, mikachu@gmail.com
Subject: Re: Fix testsuite errors due to shell quoted parameter expansion issue.
Date: Wed, 04 Aug 2010 09:27:24 -0600 [thread overview]
Message-ID: <4C5986DC.1080809@redhat.com> (raw)
In-Reply-To: <COL116-W17EA3EC8646A44EE853BCBA3AF0@phx.gbl>
[-- Attachment #1: Type: text/plain, Size: 2379 bytes --]
[please don't top-post on technical lists]
On 08/04/2010 09:18 AM, John Lumby wrote:
>
> Re the statement
>
> since "$e" is quoted, it must not be elided
>
> I don't think that is correct. In fact "$e" *must* be elided - because you juxtaposed it with the next token. eliding and quoting are orthogonal.
Your statement is confusing to me. Here, in more detail, is exactly
what I meant (and what I though I implied in the first case):
The word in question is '"$e"$f' before either parameter substitution,
or word splitting, or quote elision.
After parameter substitution, you are left with '"" val', where a
portion of the string was originally quoted, but you also had a portion
of the string that was unquoted. Only the ' val' portion of the result
is subject to word splitting.
Because "$e" is quoted, the resulting empty string must not be elided
during word splitting.
Therefore, the result after word splitting MUST be the two words '""'
and 'val'; then you apply quote elision and are left with two words: ''
and 'val'.
>
> What you appear to be be expecting is that the effect of quoting one token should somehow have some effect on interpretation of a special character (blank) in a subsequent unquoted token. I don't think that is expected behaviour. The quoting of $e has the effect of quoting any special characters inside *it*, of which there are none. your blank is unquoted. Then word-spilling proceeds.
No, what I expect is that within a single word, the quoted portion of
the word must not be elided during word splitting, except in the special
case of "$@".
>
> What I find interesting is this
>
> bash -c 'declare -i length; f=" val" e=;concat="$e"$f; length=${#concat}; echo "length= $length"'
> 4
Why do you find that interesting? There is NO word splitting in
assignment contexts, so the effect of
concat="$e"$f
is the same as if you had done
concat=$e$f
or
concat="$e$f"
in all three cases, concat is assigned the value ' val', which is indeed
length 4.
But it is unrelated to the bash bug at hand, which is that when "$e"$f
is in a context subject to word splitting, then it must result in the
two words '' and 'val', not the single word 'val'.
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2010-08-04 15:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100803203204.GG13690@gmx.de>
2010-08-03 20:55 ` Eric Blake
2010-08-03 21:21 ` Mikael Magnusson
2010-08-03 21:28 ` Eric Blake
2010-08-04 15:18 ` John Lumby
2010-08-04 15:27 ` Eric Blake [this message]
2010-08-04 17:06 ` John Lumby
2010-08-03 21:43 ` Peter Stephenson
2010-08-05 22:15 ` Chet Ramey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C5986DC.1080809@redhat.com \
--to=eblake@redhat.com \
--cc=autoconf@gnu.org \
--cc=johnlumby@hotmail.com \
--cc=libtool-patches@gnu.org \
--cc=mikachu@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).