Debian Codegraph @

test/pipeio1.awk

raw
1 # From dragon!gamgee.acad.emich.edu!dhw Tue Mar 18 01:12:15 1997
2 # Return-Path: <dragon!gamgee.acad.emich.edu!dhw>
3 # Message-ID: <[email protected]>
4 # Date: Mon, 17 Mar 97 20:48 CST
5 # From: [email protected] (David H. West)
6 # To: [email protected]
7 # Subject: gawk 3.0.2 bug report (cc of msg to bug-gnu-utils)
8 # Status: OR
9 # Content-Length: 869
10 # X-Lines: 20
11 # X-Display-Position: 2
12 #
13 # Nature of bug: operation on a pipe side-effects a different pipe.
14 # Observed-With: gawk 3.0.2, Linux kernel 2.0.28
15 # Reproduce-By: running the following script, without and with the "close"
16 # statement uncommented.
17 # -----------------cut here--------------------------
18 BEGIN {FILE1="test1"; FILE2="test2";
19 print "1\n" > FILE1; close(FILE1);
20 print "2\n" > FILE2; close(FILE2);
21 cmd1="cat " FILE1; cmd2="cat " FILE2;
22 #end of preparing commands which give easily-predictable output
23
24 while( (cmd1 | getline)==1) { #terminates as file has only 1 line
25 #and we never close cmd1
26 cmd2 | getline L;
27 #BUG: uncommenting the following line causes an infinite loop
28 close(cmd2);
29 print $0,L;
30 }
31 }