Date: Thu, 7 Dec 1995 03:01:35 +0100 (MET) From: peter@citylink.dinoex.sub.org (Peter Much) To: freebsd-hackers@freebsd.org Subject: awk (2.1-STABLE): close() misfunctional? Message-ID: <199512070201.DAA03870@citylink.dinoex.sub.org>
next in thread | raw e-mail | index | archive | help
Please check if you can reproduce the following - maybe there was a compilation error, since i did install from the source-tree above some older SNAP. ------------------------------------------------------------------- Usually, if one prints onto a pipe from awk with something like print something | "some shellscript" and afterwards closes the pipe with close ("some shellscript") , this will make the pipe recognise an end-of-file and finish. With FreeBSD 2.1-STABLE, the pipe will not recognize the end-of-file, but instead will wait on "netio" (as shown with ps), and the awk will wait forever inside the close(). But this will happen only, if there are multiple such pipes open at the same time. To reproduce, try the following: awk 'BEGIN { cmnd1 = "cat > " NR; cmnd2 = "cat > " NR "a"; } { print NR " " $0 | cmnd1; print NR " " $0 | cmnd2; close(cmnd1); cmnd1 = "cat > " NR; close(cmnd2); cmnd2 = "cat > " NR "a"; }' It will write the first input line into filename "0" and into filename "0a", and then it will hang. The workaround is to close the second pipe first and the first pipe second. This is not necessary on other OS' that use Gnu-awk. (But not to get a wrong imperssion: 2.1-STABLE is more stable than these.) Peter -- Write to: Peter Much * Koelnische Str. 22 * D-34117 Kassel * +49-561-774961 peter@citylink.dinoex.sub.org * much@hrz.uni-kassel.de
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512070201.DAA03870>