1829614 Members
2115 Online
109992 Solutions
New Discussion

ksh bug?

 
SOLVED
Go to solution
Chrisak
New Member

ksh bug?

On a machine running HP-UX B.11.00 A 9000/800, these commands hang after displaying the date once:

yes '' | head -8194 | while read x; do date; done
yes | head -4098 | while read x; do date; done
yes yes | head -2050 | while read x; do date; done
yes 1234567 | head -1026 | while read x; do date; done

but these commands show the date lots of times, as you would expect:

yes '' | head -8193 | while read x; do date; done
yes | head -4097 | while read x; do date; done
yes yes | head -2049 | while read x; do date; done
yes 1234567 | head -1025 | while read x; do date; done

This looks like a bug in ksh to me - 'sh' is fine, and it's also fine on 10.20 machines.

Is there a patch for this? It seems that if the input to the 'while' loop is more than 8k then it locks up...

Chrisak.
3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: ksh bug?

Do you have patch PHCO_27418? That's a fairly old patch so you may be way behind on all patches. I'd get all your patches for HWE and QPK to at least a 2004 datecode.


Bill Hassell, sysadmin
Steven E. Protter
Exalted Contributor

Re: ksh bug?

Bill's post reminds me that there was a series of patches(i thought security) for all the shells. You probably should have them all in production along witht he latest quarterly release.

HP-UX is not a 'if it aint broke don't fix it' OS. You gotta have a plan and be looking forward.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Chrisak
New Member

Re: ksh bug?

Thanks for the replies. Our boxes are badly out of date, apparently never having been patched at all. It seems that the problem I am encountering was addressed in PHCO_18164 (which is contained in PHCO_27418):

9. ksh(1) hangs when processing -
"cat bigfile | while read ..."
The right side of the pipe can be any shell
commands (while, if, for, etc.)

Thanks again.

Chrisak.