zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: 'case' pattern matching bug with bracket expressions
Date: Fri, 15 May 2015 21:48:25 +0100	[thread overview]
Message-ID: <20150515214825.124dcf03@ntlworld.com> (raw)
In-Reply-To: <20150515093851.57b973bc@pwslap01u.europe.root.pri>

On Fri, 15 May 2015 09:38:51 +0100
Peter Stephenson <p.stephenson@samsung.com> wrote:
> I don't think changing the case parsing to do proper words is *that*
> difficult --- it's always been a bit of a hack, so could do with
> being fixed.

I'm on the case, but just to note this isn't completely benign.  There
are (few) places in functions where we rely on the fact that anything in
parentheses is parsed as a single quoted string, which won't happen any
more.  In particular, this one from _path_commands running in the
completion tests had me stumped for half an hour:

_call_whatis() { 
  case "$(whatis --version)" in
  (whatis from *)
    local -A args
    zparseopts -D -A args s: r:
    apropos "${args[-r]:-"$@"}" | fgrep "($args[-s]"
    ;;
  (*) whatis "$@";;
  esac
}

Quoting "whatis from " fixes it.

No doubt we can track these down in functions in the distribution but it
could also crop up elsewhere.  I don't want to have to propagate the
existing hack any more, however, so this isn't really possible to work
around.

The better news is it gives a clear parse error (except in completion
tests where errors are obscurely hidden).  So perhaps it isn't so bad if
flagged up as a change.

pws


  reply	other threads:[~2015-05-15 20:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 13:14 Martijn Dekker
2015-05-14 13:50 ` [BUG] " Martijn Dekker
2015-05-14 14:42 ` Peter Stephenson
2015-05-14 15:47   ` Martijn Dekker
2015-05-14 15:55     ` Peter Stephenson
2015-05-14 17:30       ` Bart Schaefer
2015-05-15  0:05         ` Chet Ramey
2015-05-14 23:51       ` Chet Ramey
2015-05-15  8:38       ` Peter Stephenson
2015-05-15 20:48         ` Peter Stephenson [this message]
2015-05-15 21:48           ` Bart Schaefer
2015-05-14 16:17     ` Peter Stephenson
2015-05-14 17:07       ` Martijn Dekker
2015-05-14 17:43         ` Peter Stephenson
2015-05-15  0:09           ` Chet Ramey
2015-05-14 23:59       ` Chet Ramey
2015-05-14 21:23   ` Chet Ramey
2015-05-14 23:45   ` Chet Ramey

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=20150515214825.124dcf03@ntlworld.com \
    --to=p.w.stephenson@ntlworld.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).