Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: regression in ${##""}



On 06/03/2011 12:55 PM, Mikael Magnusson wrote:
> On 3 June 2011 20:00, Eric Blake <eblake@xxxxxxxxxx> 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@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author