Subject: bin/12287: m4 attaches EOF to output files
To: None <>
From: None <>
List: netbsd-bugs
Date: 02/26/2001 14:25:31
>Number:         12287
>Category:       bin
>Synopsis:       m4 attaches EOF to output files
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 26 05:15:00 PST 2001
>Originator:     Thomas Klausner
>Release:        NetBSD-current of 2001-02-25
System: NetBSD 1.5S NetBSD 1.5S (KRAFTLACKEL) #1: Sun Feb 25 14:53:34 CET 2001 macppc
Architecture: powerpc
Machine: macppc
m4 attaches a EOF character (0xff) to the end of the output file.
Try to build devel/gmp, which uses m4 to modify its assembler input files,
on macppc -- see the assembler fail, because of the trailing EOF in the
output file: 

tmp-add_n.s: Assembler messages:
tmp-add_n.s:0: Warning: end of file not at end of a line; newline inserted
tmp-add_n.s:68: Error: Rest of line ignored. First ignored character valued 0xff

The 0xff also appears on 1.4.2/i386, but the assembler doesn't seem to
mind it there.
It seems to happen in this block in usr.bin/m4/main.c, in the putbackeof:

	if (*m4wraps) { 		/* anything for rundown ??   */
		ilevel = 0;		/* in case m4wrap includes.. */
		bufbase = bp = buf;	/* use the entire buffer   */
		putbackeof();		/* eof is a must !!	     */
		pbstr(m4wraps); 	/* user-defined wrapup act   */
		macro();		/* last will and testament   */

I'm not sure what the putbackeof in this block is supposed to do,
perhaps removing it is the right thing?