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

Re: grammar triviality with '&&'



On Wed, Mar 4, 2015 at 4:18 PM, Peter Stephenson
<p.stephenson@xxxxxxxxxxx> wrote:
> On Wed, 4 Mar 2015 15:47:56 +0100
> Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>> I've found a bug:
>>
>> % alias '&&=(){ return $? } && '
>> % && echo OK
>> zsh: parse error near `&&'
>
> (Moved to zsh-workers)
>
> I was keeping very quiet about this, but it looks like it's not as hairy
> as I thought it might be and the new code is actually slightly cleaner...
>
> Now waiting for obscure failures elsewhere...

All I have to do is press ctrl-c at a prompt, and it crashes:

Core was generated by `zsh -f'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000000000435477 in hasher (str=0x1 <error: Cannot access memory
at address 0x1>)
    at hashtable.c:85
85        while ((c = *((unsigned char *) str++)))
(gdb) bt
#0  0x0000000000435477 in hasher (str=0x1 <error: Cannot access memory
at address 0x1>)
    at hashtable.c:85
#1  0x0000000000435490 in gethashnode (ht=0x1a9b6a0, nam=0x0) at hashtable.c:231
#2  0x00000000004484fc in checkalias () at lex.c:1743
#3  0x000000000044ae74 in exalias () at lex.c:1784
#4  0x000000000044b0b7 in zshlex () at lex.c:272
#5  0x0000000000467d93 in parse_event (endtok=endtok@entry=37) at parse.c:538
#6  0x000000000043dc29 in loop (toplevel=toplevel@entry=1,
justonce=justonce@entry=0)
    at init.c:145
#7  0x0000000000440a32 in zsh_main (argc=<optimized out>,
argv=0x7fffef4307d8) at init.c:1674
#8  0x000000000040f1c6 in main (argc=<optimized out>, argv=<optimized
out>) at ./main.c:93

(Note that if you run it inside gdb, you need to change the settings
for 'handle SIGINT' with the command:
(gdb) handle SIGINT nostop noprint pass
or gdb will eat the ctrl-c)

-- 
Mikael Magnusson



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