🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #1630

GNU awk 2.10 has trouble reading from pipes on an Encore

#1630
From: Mic Kaczmarczik
Date: Thu, 25 May 1989 17:03
51 lines
2259 bytes
After we installed GNU Awk 2.10 on an Encore Multimax running UMAX
3.2, we found that commands of the form
	cat file | gawk '{print $0}'

would produce no output, instead of copying standard input to standard
output.  Redirecting standard input from a normal file worked fine,
however. 

I found that iop_alloc() in awk7.c uses fstat() to determine the input
buffer size to be used for a file descriptor. Under UMAX 3.2, fstat()
on a pipe returns 0 for both the file and block size, so the input
buffer size was being set to 0.  I modified the DEFBLKSIZE macro to
fall back to BUFSIZ if the block size was 0, and the program works
fine now.  A context diff is enclosed below. 

Mic Kaczmarczik
UT Austin Computation Center
mic@emx.utexas.edu

--------------------------CUT HERE-------------------------------------

*** awk7.c.dist	Wed Apr  5 10:57:03 1989
--- awk7.c	Thu May 25 11:13:06 1989
***************
*** 754,764 ****
  	 * stat structure. So we have to make some sort of reasonable
  	 * guess. We use stdio's BUFSIZ, since that what it was
  	 * meant for in the first place.
  	 */
  #if defined(USG) || defined(MSDOS)
  #define	DEFBLKSIZE	BUFSIZ
  #else
! #define DEFBLKSIZE	stb.st_blksize
  #endif
  
  	if (fd == -1)
--- 754,767 ----
  	 * stat structure. So we have to make some sort of reasonable
  	 * guess. We use stdio's BUFSIZ, since that what it was
  	 * meant for in the first place.
+ 	 * 
+ 	 * If stb.st_blksize is 0, make the default block size BUFSIZ.
+ 	 * This happens when you fstat() a pipe under UMAX 3.2 on an Encore.
  	 */
  #if defined(USG) || defined(MSDOS)
  #define	DEFBLKSIZE	BUFSIZ
  #else
! #define DEFBLKSIZE	(stb.st_blksize ? stb.st_blksize : BUFSIZ)
  #endif
  
  	if (fd == -1)
Technical Details
Message-ID: <CMM.0.88.612119016.mic@emx.utexas.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!tut.cis.ohio-state.edu!EMX.UTEXAS.EDU!mic

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!tut.cis.ohio-state.edu!EMX.UTEXAS.EDU!mic
From: mic@EMX.UTEXAS.EDU (Mic Kaczmarczik)
Newsgroups: gnu.utils.bug
Subject: GNU awk 2.10 has trouble reading from pipes on an Encore
Message-ID: <CMM.0.88.612119016.mic@emx.utexas.edu>
Date: 25 May 89 17:03:36 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: UT Austin Computation Center, User Services Unix Support Group
Lines: 51