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

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



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. (And just swapping the
last two tests would make it so that it accepts a definition with a different
name than expected.)

The patch seems to work for me if i change the condition to this:

  if (*ptr1 != *ptr2 && !(*ptr1 == '-' && *ptr2 == Dash))

Thanks!

dana



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