zsh-workers
 help / color / mirror / code / Atom feed
From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Cc: Peter Stephenson <p.stephenson@samsung.com>
Subject: Re: [BUG] quoting within bracket patterns has no effect
Date: Sat, 23 Jan 2016 00:17:44 +0000	[thread overview]
Message-ID: <56A2C6A8.4090108@inlv.org> (raw)
In-Reply-To: <20160118172434.2fb7d5b9@pwslap01u.europe.root.pri>

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


  parent reply	other threads:[~2016-01-23  0:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18  4:23 Martijn Dekker
2016-01-18 17:24 ` Peter Stephenson
2016-01-19 15:57   ` Jun T.
2016-01-19 17:35     ` Peter Stephenson
2016-01-19 18:54       ` Bart Schaefer
2016-01-20 10:48       ` Jun T.
2016-01-20 11:04         ` Peter Stephenson
2016-01-19 16:03   ` Peter Stephenson
2016-01-19 16:25     ` Mikael Magnusson
2016-01-19 16:34       ` Peter Stephenson
2016-01-19 18:41     ` Bart Schaefer
2016-01-23  0:17   ` Martijn Dekker [this message]
2016-01-23  1:49     ` Bart Schaefer
2016-01-26  4:03       ` Martijn Dekker
2016-01-26  4:48         ` Bart Schaefer
2016-01-26 14:07           ` Martijn Dekker
2016-01-27  3:05             ` Bart Schaefer

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=56A2C6A8.4090108@inlv.org \
    --to=martijn@inlv.org \
    --cc=p.stephenson@samsung.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).