Unix Technical Forum

Re: bug in ksh ?

This is a discussion on Re: bug in ksh ? within the lucky.openbsd.misc forums, part of the OpenBSD category; --> On Mon, Aug 28, 2006 at 01:33:59AM +0200, Ingo Schwarze wrote: | > Please now try `if ! false; ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > lucky.openbsd.misc

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 07:27 AM
Paul de Weerd
 
Posts: n/a
Default Re: bug in ksh ?

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?
|
| schwarze@idefix $ uname -a
| OpenBSD idefix 3.9 GENERIC#617 i386
| schwarze@idefix $ /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.

Cheers,

Paul 'WEiRD' de Weerd

--
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+

+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
http://www.weirdnet.nl/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:32 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com