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

Re: seg fault on $(dgqhghdqwdhqwjq) : beta19



hzoli@xxxxxxxxxx wrote:
> > res1% $(wekdwqw)
> > zsh: command not found: wekdwqw
> > zsh: 21441 segmentation fault  $(wekdwqw)
> 
> It always happens when prefork() in execcmd() removes all arguments.

It's not quite that simple: prefork turns the first argument into an
empty string, so the argument list isn't quite null and negotiates all
the tests for nonempty(args).  However, fixcline() then comes along
and unhooks the empty argument, leaving an empty list.  This is when
the trouble starts.  Maybe the substitution code needs to be smarter
and unhook its own null arguments, then we can handle empty lines
more consistently in execcmd().  I suppose this goes in prefork().

By the way, it's handled OK with double quotes present:

% zsh -fc '"$(doallmyworkforme)"'
zsh: command not found: doallmyworkforme
zsh: permission denied: 

since there's no command matching the null string.  If that's
acceptable when the quotes are missing (behaviour of other shells
suggests it isn't), a simpler solution is to adapt fixcline() to leave
an empty string if its the only thing left on the line.

Could we simply call fixcline() after or even in prefork(), leaving the
way open for sensible tests in execcmd()?

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.




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