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

Re: 'case' pattern matching bug with bracket expressions



Peter Stephenson schreef op 14-05-15 om 17:17:
> I don't *think* the following patch makes anything worse,

Thanks for the patch. I just tested it against zsh 5.0.7-dev-2.

It does solve the simple cases of:

case abc in ( [] ) echo yes ;; ( * ) echo no ;; esac
empty=''
case abc in ( ["$empty"] ) echo yes ;; ( * ) echo no ;; esac

which are now a non-match instead of an error, as I would expect.

However, the more insidious case that bit me:

case abc in ( [] | [!a-z]* ) echo yes ;; ( * ) echo no ;; esac
empty=''
case abc in ( ["$empty"] | [!a-z]* ) echo yes ;; ( * ) echo no ;; esac

still produces a false positive even with the patch.

- Martijn



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