zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Mikael Magnusson <mikachu@gmail.com>, zsh workers <zsh-workers@zsh.org>
Subject: Re: Pattern matching: backslash escaping not active in pattern passed from variable
Date: Mon, 18 May 2015 09:49:08 +0100	[thread overview]
Message-ID: <20150518094908.7189d00f@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAHYJk3QidZOWxcaxUDszmHvryRAQZMGiRYZoE5ETWT=BUc_nWg@mail.gmail.com>

On Mon, 18 May 2015 10:33:31 +0200
Mikael Magnusson <mikachu@gmail.com> wrote:
> On Mon, May 18, 2015 at 5:07 AM, Martijn Dekker <martijn@inlv.org> wrote:
> > Peter Stephenson's patch for case pattern matching applied cleanly
> > against the latest git code and is working perfectly. Many thanks.
> >
> > There is another snag I've found in pattern matching, which seems to
> > have survived this patch: backslash escaping does not seem match the
> > standard if a glob pattern is passed from a variable or parameter. The
> > standard says:
> [...]
> > In any case, I would expect backslash escaping to work the same way
> > whether the glob pattern is passed from a variable or parameter or not.
> 
> see the GLOB_SUBST option.

GLOB_SUBST roughly covers the last remark (and GLOB_SUBST is on in POSIX
mode), but not the thing about backslashes --- zsh only removes the
backslashes around pattern characters, not other characters, if it knows
the context is just quoting patterns, which is true of characters made
"live" by the effect of GLOB_SUBST.  That's why the new (b) parameter
expansion flag turned up.

I suppose that ought to be fixable in compatibility mode --- we
certainly don't want to mess around with quoting in native mode.

(I said "roughly" above because there's a big can of worms here about
when quoting happens --- normal backslash quoting happens on input to
the lexer, backslash quoting of patterns much later and in this case
possibly in addition --- but the intention is GLOB_SUBST should at least
make zsh look like other shells, messy though that is.)

pws


      reply	other threads:[~2015-05-18  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18  3:07 Martijn Dekker
2015-05-18  8:33 ` Mikael Magnusson
2015-05-18  8:49   ` Peter Stephenson [this message]

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=20150518094908.7189d00f@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.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).