zsh-workers
 help / color / mirror / code / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: regression in ${##""}
Date: Fri, 03 Jun 2011 13:16:24 -0600	[thread overview]
Message-ID: <4DE93308.7000105@redhat.com> (raw)
In-Reply-To: <BANLkTinWR8LuiQiHoVNABB2uuMt_U4d3TQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

On 06/03/2011 12:55 PM, Mikael Magnusson wrote:
> On 3 June 2011 20:00, Eric Blake <eblake@redhat.com> wrote:
>> POSIX requires ${##""} to be parsed as ${parameter#word} with parameter
>> of # and word of "", which results in the output of $# with the shortest
>> prefix of the empty string removed (aka ${#}).  But current zsh.git
>> rejects this:
>>
>> $ ./Src/zsh -c 'set a b; echo ${##""}'
>> zsh:1: bad substitution
>>
>> Worse, this is a regression:
>>
>> $ zsh -c 'set a b; echo ${##""}'
>> 2
>> $ rpm -q zsh
>> zsh-4.3.10-5.fc14.x86_64
> 
> Not a surprise, this is due to
> 
> 28889: ${##} should return the length of $#

Before you go changing anything, though, I just filed a bug against POSIX:

http://austingroupbugs.net/view.php?id=457

which recommends that ${parameter#word} and ${parameter##word} be
changed to be unspecified if parameter is #; this relaxation in the
standard would permit current zsh behavior.

-- 
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 --]

  reply	other threads:[~2011-06-03 19:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 18:00 Eric Blake
2011-06-03 18:55 ` Mikael Magnusson
2011-06-03 19:16   ` Eric Blake [this message]
2011-06-03 20:16   ` Peter Stephenson

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=4DE93308.7000105@redhat.com \
    --to=eblake@redhat.com \
    --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).