Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!esquire!yost From: yost@esquire.UUCP (David A. Yost) Newsgroups: comp.lang.icon Subject: a reads() bug Message-ID: <1785@esquire.UUCP> Date: 14 Feb 90 21:06:57 GMT Organization: DP&W, New York, NY Lines: 42 #!/bin/sh # Demonstrate Icon reads() bug on Sun4 # Reading more characters than available on a pipe can cause trouble # Don't know if it is a system bug or an Icon bug # May also be a problem if reading from a device. # Works OK on the Pyramid # Icon version 7.5 # Moral of the story, reads(,4096) at a time, max # 2/14/90 Dave Yost, DP&W pipebufsize=4096 just_big_enough_for_trouble1=`expr $pipebufsize + 1` just_big_enough_for_trouble2=`expr $pipebufsize + 1` tmp=xxx bigfile=/etc/termcap dd ibs=$just_big_enough_for_trouble1 count=1 < $bigfile > $tmp cat << END > pipebug.icn procedure main (args) while writes(reads(&input, $just_big_enough_for_trouble2)) return end END icont pipebug.icn echo ">> Both of these commands should succeed, but for the bug " echo ">> ./pipebug < $tmp | cmp - $tmp" ./pipebug < $tmp | cmp - $tmp echo ">> cat $tmp | ./pipebug | cmp - $tmp" cat $tmp | ./pipebug | cmp - $tmp rm -f pipebug.icn $tmp