Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.0
Message-ID: <56A2C6A8.4090108@inlv.org>
Date: Sat, 23 Jan 2016 00:17:44 +0000
From: Martijn Dekker <martijn@inlv.org>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.2.0
MIME-Version: 1.0
To: zsh-workers@zsh.org
CC: Peter Stephenson <p.stephenson@samsung.com>
Subject: Re: [BUG] quoting within bracket patterns has no effect
References: <569C68AB.2010806@inlv.org> <20160118172434.2fb7d5b9@pwslap01u.europe.root.pri>
In-Reply-To: <20160118172434.2fb7d5b9@pwslap01u.europe.root.pri>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Seq: zsh-workers 37733

> On Mon, 18 Jan 2016 05:23:07 +0100
> Martijn Dekker <martijn@inlv.org> wrote:
>> > Quotes should disable the special meaning of characters in glob
>> > patterns[*].
>> >
>> > [*] "If any character (ordinary, shell special, or pattern special) is
>> > quoted, that pattern shall match the character itself."
>> > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_01

In the current git version of zsh (zsh-5.2-97-g1aec003), this bug is now
fixed for literal patterns:

case b in
( ['a-c'] ) echo 'false match' ;;
( [a-c] )   echo 'correct match' ;;
esac

outputs "correct match" as expected.

However, for variables there is now a new problem, the opposite of the
old one: unlike in every other shell, a range is not recognised even if
the variable is *not* quoted. So quoting a variable still has no effect,
it's just that range parsing from variables was disabled altogether. The
following code:

myrange='a-z'
somevar='c'
case $somevar in
( *[$myrange]* )  echo "$somevar is part of $myrange" ;;
esac

outputs "c is part of a-z" on every shell except current zsh.

Quoting the variable ( *["$myrange"]* ) should make it output nothing.

Thanks,

- M.

