yost@esquire.UUCP (David A. Yost) (02/15/90)
#!/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 <yost@DPW.COM> 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