From smp@rick.systemsix.com  Sat Mar 11 01:47:06 1995
Received: from rick.systemsix.com (rick.systemsix.com [198.99.86.136]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id BAA25531 for <FreeBSD-gnats-submit@freebsd.org>; Sat, 11 Mar 1995 01:46:54 -0800
Received: (from smp@localhost) by rick.systemsix.com (8.6.9/8.6.9) id UAA00334; Fri, 10 Mar 1995 20:00:42 -0700
Message-Id: <199503110300.UAA00334@rick.systemsix.com>
Date: Fri, 10 Mar 1995 20:00:42 -0700
From: smp@clem.systemsix.com
Reply-To: smp@clem.systemsix.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: m4 syscmd() bug
X-Send-Pr-Version: 3.2

>Number:         237
>Category:       bin
>Synopsis:       m4 syscmd() function's output out of sync
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs (FreeBSD bugs mailing list)
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 11 01:50:02 1995
>Closed-Date:    Sat Mar 11 08:58:41 PST 1995
>Last-Modified:
>Originator:     Steve Passe
>Release:        FreeBSD 2.1.0-Development i386
>Organization:
New Ideas
>Environment:

	2.0-950210-SNAP

>Description:

	when an m4 program uses the syscmd() function the output of the
	system() call made by syscmd() is out of sync with the data stream
	of m4.

>How-To-Repeat:

	run m4 on a file containing the following:

define(MACRO, `syscmd(echo -n foo)')

some text with "MACRO" in it

<< END OF SAMPLE INPUT

	this will produce:

foosome text with "" in it

but should produce:

some text with "foo" in it



>Fix:
	
	patch src/usr.bin/m4/eval.c as follows:

diff eval.c.orig eval.c
173c173,177
< 	 */
---
> 	 */		
> 		/* Make sure m4 output is NOT interrupted */		
> 		fflush(stdout);			
> 		fflush(stderr);
>
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ache 
State-Changed-When: Sat Mar 11 08:58:41 PST 1995 
State-Changed-Why:  
Fix applied. 
>Unformatted:



