From owner-freebsd-hackers Thu Dec 7 09:23:34 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id JAA00376 for hackers-outgoing; Thu, 7 Dec 1995 09:23:34 -0800 (PST) Received: from subnet.sub.net (root@subnet.sub.net [192.101.75.3]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id JAA00334 for ; Thu, 7 Dec 1995 09:23:22 -0800 (PST) Received: from dinoex.UUCP (root@localhost) by subnet.sub.net (8.6.12/8.6.12) with UUCP id SAA02497 for freebsd.org!freebsd-hackers; Thu, 7 Dec 1995 18:23:00 +0100 Received: from phase23.dinoex.sub.org by ud.dinoex.sub.org with uucp (Linux Smail3.1.28.1 #14) id m0tNZgj-000JiQC; Thu, 7 Dec 95 07:20 MET Received: from citylink.dinoex.sub.org by phase23.dinoex.sub.org with uucp (CY Smail3.1.28.1 #6) id m0tNVqi-0005MGC; Thu, 7 Dec 95 03:14 MET From: peter@citylink.dinoex.sub.org (Peter Much) Message-Id: <199512070201.DAA03870@citylink.dinoex.sub.org> Received: by citylink.dinoex.sub.org (8.6.12 FreeBSD-1/PMuch) id DAA03870 for freebsd-hackers@freebsd.org; Thu, 7 Dec 1995 03:01:37 +0100 Subject: awk (2.1-STABLE): close() misfunctional? To: freebsd-hackers@freebsd.org Date: Thu, 7 Dec 1995 03:01:35 +0100 (MET) X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-hackers@freebsd.org Precedence: bulk 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