On Mon, Aug 28, 2006 at 12:59:28AM +0200, Paul de Weerd wrote:
> hi all,
>
> While reading ksh(1) I found :
>
> A pipeline may be prefixed by the `!' reserved word,
> which causes the exit status of the pipeline to be
> logically complemented: if the original status was
> 0, the complemented status will be 1; if the
> original status was not 0, the complemented status
> will be 0.
>
> Please now try `if ! false; then echo true; fi`. Why does my shell eat
> muchos CPU & RAM after such a short pipeline ? This appears to be a
> bug in our ksh. I've tried bash (i know), FreeBSD's /bin/sh and
> FreeBSD's ksh (also from pdksh, from what I can tell) all do what one
> would expect.
>
> I've seen this behaviour before but never spent the time to
> investigate. Now it seems that ksh(1) may be at fault (or the manpage,
> but since other shells seem to do it right, I would suspect ksh(1)
> first).
>
> Anyone with a definitive answer ? Is this a bug or am I missing
> something ?
I just tried this on my recent -current build; ps -lh:
Before:
UID PID PPID CPU PRI NI VSZ RSS WCHAN STAT TT TIME
COMMAND
1000 12404 8217 1 18 0 432 524 pause Is p2 0:00.01
/bin/ksh /b
After:
1000 12404 8217 1 18 0 432 524 pause Is p2 0:00.01
/bin/ksh /b
As you can see, not much appears to have happened. How can we reproduce
this?
Joachim