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

Re: Bug report: segfault when pasting (function and alias names collide)



I tried to reduce it as far as possible, but it does not happen without
oh-my-zsh.
This is the minimal version that still shows the segfault:

    source $ZSH/oh-my-zsh.sh

    alias h='history'

    h() {
      echo "foo"
    }

Steps to reproduce:

   0) install latest oh-my-zsh
   1) Invoke `zsh -f`
   2) source the above script
   3) paste anything




On Fri, Jan 6, 2017 at 3:29 AM, Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx>
wrote:

> Victor Volle wrote on Thu, Jan 05, 2017 at 17:21:03 +0100:
> > I think this may already have been reported in 2010:
> > https://www.zsh.org/mla/workers/2010/msg00521.html
> > but it does not seem to be fixed.
>
> The part with function and alias has not been "fixed" because it's not
> a bug.  To define a function without interpreting aliases in the
> function name, use this syntax:
>
>     function f {
>       ⋮
>     }
>
> > If the redefinition is problematic, would it be possible to trigger an
> > error, when the function
> > is defined? A segfault when pasting seems to be quite bad.
>
> All segfaults are bug, but how do you reproduce this one?  I did:
>
> $ zsh -f
> % history() {
>   ⋮ copied the function body from your mail
>   }
> % <paste>
>
> and it did not segfault.  Can you provide a minimal reproduction script
> starting from `zsh -f`?  (and without third party modules, if at all
> possible)
>
> Thanks,
>
> Daniel
>


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