On Mon, 28 Aug 2006, Paul de Weerd wrote:

> On Mon, Aug 28, 2006 at 01:33:59AM +0200, Ingo Schwarze wrote:
> | > Please now try `if ! false; then echo true; fi`.
> | > Why does my shell eat muchos CPU & RAM after such a short pipeline?
> | 
> | [EMAIL PROTECTED] $ uname -a
> | OpenBSD idefix 3.9 GENERIC#617 i386
> | [EMAIL PROTECTED] $ /bin/ksh
> | $ date
> | Mon Aug 28 01:28:07 CEST 2006
> | $ if ! false; then echo true; fi
> | true
> | $ date                           
> | Mon Aug 28 01:28:12 CEST 2006
> | $ date; ( if ! false; then echo true; fi ); date
> | Mon Aug 28 01:28:20 CEST 2006
> | true
> | Mon Aug 28 01:28:20 CEST 2006
> | $ time ( if ! false; then echo true; fi )
> | true
> |     0m0.01s real     0m0.00s user     0m0.01s system
> | $ time ( echo `if ! false; then echo true; fi` )
> | true
> |     0m0.04s real     0m0.00s user     0m0.02s system
> | $ exit
> | 
> | Sorry, cannot reproduce.
> | Works for me (on OpenBSD 3.9-release).
> 
> Now it takes quite a bit of time before it actually reaches this.
> Searching the manpage a bit more, I found another reference to '!'.
> 
>       $ set +o csh-history
>       $ time ( if ! false; then echo true; fi )
>       true
>           0m0.00s real     0m0.00s user     0m0.01s system
>       $ set -o csh-history
>       $ time ( if ! false; then echo true; fi )
>       /bin/ksh: internal error: unable to allocate memory
> 
> Since I set csh-history in my .kshrc, this option is set in all my
> shells. I don't think this is intended behaviour, but if it is, it
> probably should be documented in the manpage.

I think this is a bug.

I looked a bit at this and it seems a loop in the lexical anaylzer,
introduced by the code starting at line 162 of lex.c

Sadly this code is quite hard to follow. I'll try to dig a bit further
later. 

        -Otto

Reply via email to