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

More incmdpos stuff Re: Crash Re: Trial for 5.0.7



On 3 October 2014 10:58, Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> On Thu, 02 Oct 2014 21:58:56 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>> On Oct 2,  8:33pm, Bart Schaefer wrote:
>> }
>> } git-bisect says this is the bad revision:
>> }
>> } commit 8189e12312ede991827efc6683b7ce8463deb0bf
>> }
>> }     32552 (updated by 32560): fix segfault when using process substitution in
>> } anonymous function argument list
>> }
>> }     Also disallow process substitution in function name position.
>>
>> OK, I've narrowed it down to the parse.c hunks of the patch.  Remove
>> just that change, and the crash on piping to an anonymous function is
>> fixed, but this test fails:
>>
>> ./C04funcdef.ztst: starting.
>> Test ./C04funcdef.ztst failed: bad status 1, expected 0 from:
>>   () (cat $1 $2) <(print process expanded) =(print expanded to file)
>> Error output:
>> (eval):1: process substitution <(print process expanded) cannot be used here
>> Was testing: Process substitution with anonymous functions
>> ./C04funcdef.ztst: test failed.
>>
>> Here's the patch to revert workers/32552 (parse.c).  I haven't figured
>> out why fiddling with *complex here mangles the wordcode, some help is
>> appreciated.  Obviously the above test needs to pass.
>
> (I presume that *is* an anonymous function, I'd forgotten that
> functions could be defined with parentheses for the bodies.  Presumably
> using braces makes no difference, though?)

% () ( echo hi; echo $@ ) ls
hi
ls --color=auto -T 0 -A -v --quoting-style=shell

I thought "aha, pws recently fixed something like this so I can just
look at that commit and fix it", but then I looked at the code.

With shortloops set, you can also do the following;
% () for a; ( echo hi; echo $a ) ls
hi
ls
hi
--color=auto
hi
-T
hi
0
hi
-A
hi
-v
hi
--quoting-style=shell

% () for a ( echo hi; echo $a ) ls
.cvsignore     Completion  META-FAQ      Test            config.h.in
     install-sh
[quadruple file listing elided (why four, you say? i don't know, ls is
aliased to two words, \ls $LS_OPTIONS, the second expands to 6
words.)]

(This is why i don't have shortloops set, every syntax error does
something random instead). The second result of actually running ls
happens even without the anon function, eg just
% for a ( echo hi; echo $a ) ls
does it.

% for a; ( echo hi; echo $a ) ls
zsh: parse error near `ls'

-- 
Mikael Magnusson

        ecadd(0);
        ecadd(0);
        ecadd(0);



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