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

Re: [BUG] Strange auto-load behaviour when function name contains hyphen



On Thu, 14 Dec 2017 11:21:21 -0600
dana <dana@xxxxxxx> wrote:
> On 14 Dec 2017, at 04:28, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> >+    /*
> >+     * See if name of function requested (name) is same as
> >+     * name of function in word code.  name may still have "-"
> >+     * tokenised.
> >+     */
> >+    ptr1 = name;
> >+    ptr2 = ecrawstr(prog, pc + 1, NULL);
> >+    while (*ptr1 && *ptr2) {
> >+	if (*ptr1 != *ptr2 && *ptr1 != Dash && *ptr2 != '-')
> 
> I think there's another error here. name isn't the one that might be tokenised
> (or it's not in my case anyway) — it's the other one.

That suggests another bug since I don't think function names in the word
code ought to be tokenised, but quite possibly that hasn't been an issue
up to now.  I haven't gone looking for that --- I've just handled both
cases (and added a test for the obvious case).

> Understanding a bit more about the token thing, i went and tested some of the
> others defined in zsh.h. The same problem occurs if you have a function name
> containing almost any of them.

Dash is a bit of a special case, since in normal zsh syntax it's
actually not a pattern character.  Things like * and ? will cause
immediate expansion, so any function name using them always has to be
quoted.  There's not a lot of point in supporting ths, though, as you
say, it's not explicitly excluded at the moment.

Quotes are stripped from the word on the command line before the
comparision.  I think that's all that sanity really requires.

pws



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