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

Re: 'case' pattern matching bug with bracket expressions

On Fri, 15 May 2015 09:38:51 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> 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 "$@";;

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

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.


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