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

Re: Parse error on autoload -X and a function with & in name



On Tue, 9 Jul 2019 at 00:12, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Try this (apologies if gmail line wraps the @@ heading):
>
> diff --git a/Src/builtin.c b/Src/builtin.c
> index 9b9e76c77..7db36c41b 100644
> --- a/Src/builtin.c
> +++ b/Src/builtin.c
> @@ -3029,7 +3029,7 @@ eval_autoload(Shfunc shf, char *name, Options
> ops, int func)
>      }
>      if (OPT_MINUS(ops,'X')) {
>         char *fargv[3];
> -       fargv[0] = name;
> +       fargv[0] = quotestring(name, QT_SINGLE_OPTIONAL);
>         fargv[1] = "\"$@\"";
>         fargv[2] = 0;
>         shf->funcdef = mkautofn(shf);

The patch works:

echo echo hello > '&abcd'
function \&abcd() {
    autoload -X
}
\&abcd
hello

--
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org



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