Bug 237 - m4 syscmd() function's output out of sync
Summary: m4 syscmd() function's output out of sync
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1995-03-11 01:50 UTC by smp
Modified: 1995-03-11 01:50 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description smp 1995-03-11 01:50:02 UTC
	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.

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);
>
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
Comment 1 Andrey A. Chernov freebsd_committer freebsd_triage 1995-03-11 16:58:41 UTC
State Changed
From-To: open->closed

Fix applied.