1 GNU M4 NEWS - User visible changes.
2 Copyright (C) 1992, 1993, 1994, 2004, 2005, 2006, 2007, 2008 Free Software
5 * Noteworthy changes in Version 1.4.11 (2008-04-02) [stable]
6 Released by Eric Blake, based on git version 1.4.10a
8 ** Security fixes for the -F option, for bugs present since -F was
9 introduced in 1.3: Avoid core dump with 'm4 -F file -t undefined', and
10 avoid arbitrary code execution with certain file names.
12 ** Fix regression introduced in 1.4.9b in the `divert' builtin when more
13 than 512 kibibytes are saved in diversions on platforms like NetBSD
14 or darwin where fopen(name,"a+") seeks to the end of the file.
16 ** The output of the `maketemp' and `mkstemp' builtins is now quoted if a
17 file was created. This is a minor security fix, because it was possible
18 (although rather unlikely) that an unquoted string could match an
19 existing macro name, such that use of the `mkstemp' output would trigger
20 inadvertent macro expansion and operate on the wrong file name.
22 ** Enhance the `defn' builtin to support concatenation of multiple text
23 arguments, as required by POSIX. However, at this time, it is not
24 possible to concatenate a builtin macro with anything else; a warning is
25 now issued if this is attempted, although a future version of M4 may
26 lift this restriction to match other implementations.
28 ** Enhance the `format' builtin to parse all C99 floating point numbers,
29 even on platforms where strtod(3) is buggy, although the replacement
30 function does have the known issue of rounding errors when parsing
31 some decimal floating point values. This fixes testsuite failures
34 ** Enhance the `index' builtin to guarantee linear behavior, in spite of
35 the surprisingly large number of systems with a brain-dead quadratic
38 ** A number of portability improvements inherited from gnulib.
40 * Noteworthy changes in Version 1.4.10 (2007-07-09) [stable]
41 Released by Eric Blake, based on CVS version 1.4.9c
43 ** Upgrade from GPL version 2 to GPL version 3 or later.
45 ** A number of portability improvements inherited from gnulib.
47 ** Avoid undefined behavior introduced in 1.4.9b in the `format' builtin
48 when handling %c. However, this area of code has never been documented,
49 and currently does not match the POSIX behavior of printf(1), so it may
50 have further changes in the next version.
52 * Noteworthy changes in Version 1.4.9b (2007-05-29) [beta]
53 Released by Eric Blake, based on CVS version 1.4.9a
55 ** Fix regression introduced in 1.4.9 in the `eval' builtin when performing
58 ** Fix regression introduced in 1.4.8 in the `-F' option that made it
59 impossible to freeze more than 512 kibibytes of diverted text.
61 ** The synclines option `-s' no longer generates sync lines in the middle of
62 multiline comments or quoted strings.
64 ** Work around a number of corner-case POSIX compliance bugs in various
65 broken stdio libraries. In particular, the `syscmd' builtin behaves
66 more predictably when stdin is seekable.
68 ** The `format' builtin now understands formats such as %a, %A, and %'hhd,
69 and works around a number of platform printf bugs. Furthermore, the
70 sequence format(%*.*d,-1,-1,1) no longer outputs random data. However,
71 some non-compliant platforms such as mingw still have known bugs in
72 strtod that may cause testsuite failures.
74 ** The testsuite is improved to also run gnulib portability tests for the
75 features that M4 imports from gnulib.
77 * Noteworthy changes in Version 1.4.9 (2007-03-23) [stable]
78 Released by Eric Blake, based on CVS version 1.4.8c
80 ** Minor documentation and portability cleanups.
82 * Noteworthy changes in Version 1.4.8b (2007-02-24) [beta]
83 Released by Eric Blake, based on CVS version 1.4.8a
85 ** Fix a regression introduced in 1.4.8 that made m4 unable to process
86 files larger than 2GiB on some platforms.
88 ** Fix a regression introduced in 1.4.8 that made m4 dump core when
89 invoked as 'm4 -- file'.
91 ** The `eval' builtin now follows C precedence rules. Additionally, the
92 short-circuit operators correctly short-circuit division by zero. The
93 previously undocumented alias of '=' meaning '==' in eval now triggers a
94 deprecation warning, so that a future version of M4 can implement a form
95 of variable assignment as an extension.
97 ** The `include' builtin now affects exit status on failure, as required by
98 POSIX. Use `sinclude' if you need a successful exit status.
100 ** The `-E'/`--fatal-warnings' command-line option now has two levels. When
101 specified only once, warnings affect exit status, but execution
102 continues, so that you can see all warnings instead of fixing them one
103 at a time. To achieve 1.4.8 behavior, where the first warning
104 immediately exits, specify -E twice on the command line.
106 ** A new `--warn-macro-sequence' command-line option allows detection of
107 sequences in `define' and `pushdef' definitions that match an optional
108 regular expression. The default regular expression is
109 `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might
110 not behave correctly when upgrading to the eventual M4 2.0. By default,
111 M4 2.0 will follow the POSIX requirement that a macro definition
112 containing `$11' must expand to the first argument concatenated with 1,
113 rather than the eleventh argument; and will take advantage of the POSIX
114 wording that allows implementations to treat `${11}' as the eleventh
115 argument instead of literal text. Be aware that Autoconf 2.61 will not
116 work with this option enabled with the default regular expression; but
117 Autoconf 2.62 will be compatible with this option.
119 ** Improved portability to platforms such as BSD/OS and AIX.
121 * Noteworthy changes in Version 1.4.8 (2006-11-20) [stable]
122 Released by Eric Blake, based on CVS version 1.4.7a
124 ** The `divert' macro and `-H'/`--hashsize' command line option no longer
125 cause a core dump when handed extra large values. Also, `divert' now
126 uses memory proportional to the number of diversions in use, rather than
127 to the maximum diversion number encountered, so that large diversion
128 numbers are less likely to exhaust system memory; and is no longer
129 limited by the maximum number of file descriptors.
131 ** The `--help' and `--version' command line options now consistently
132 override all earlier options. For example, `m4 --debugfile=trace
133 --help' now no longer accidentally creates an empty file `trace'.
135 ** The `-L'/`--nesting-limit' command line option can now be set to 0
136 to remove the default limit of 1024. However, it is still possible that
137 heavily nested input can cause abrupt program termination due to stack
140 ** Problems encountered when writing to standard error, such as with the
141 `errprint' macro, now always cause a non-zero exit status.
143 ** Warnings and errors issued during macro expansion are now consistently
144 reported at the line where the macro name was detected, rather than
145 where the close parenthesis resides. Text wrapped by `m4wrap' now
146 remembers the location that was in effect when m4wrap was invoked,
147 rather than changing to line 0 and the empty string for a file. The
148 macros `__line__' and `__file__' now work correctly even as the last
149 token in an included file.
151 ** The `builtin' and `indir' macros now transparently handle builtin
152 tokens generated by `defn'.
154 ** When diversions created by the `divert' macro collect enough text that
155 M4 must use temporary files, the environment variable $TMPDIR is now
156 consulted, and a better effort is made to clean up those files in the
157 event of a fatal signal.
159 ** The `mkstemp' builtin is added with the same GNU semantics as `maketemp',
160 based on the recommendation of POSIX to deprecate the POSIX semantics of
161 `maketemp' as inherently insecure. In GNU mode (no -G supplied on the
162 command line), `maketemp' silently retains the secure GNU semantics, but
163 a future release of M4 will change this to emit a warning. In
164 traditional mode (m4 -G), `maketemp' now uses the POSIX-mandated
165 insecure semantics, and issues a warning that you should convert your
166 script to use `mkstemp' instead. Additionally, `mkstemp' and `maketemp'
167 are now well-defined even if the template argument does not end in six
170 ** The manual has been improved, including a new section on a composite
173 ** The `changecom' and `changequote' macros now treat an empty second
174 argument the same as if it were missing, rather than using the empty
175 string and making it impossible to end a comment or quote.
177 ** The `translit' macro now operates in linear instead of quadratic time,
178 and is now eight-bit clean.
180 ** The `-D', `-U', `-s', and `-t' command line options now take effect
181 after any files encountered earlier on the command line, rather than up
182 front, as is done in traditional implementations and required by POSIX.
184 * Noteworthy changes in Version 1.4.7 (2006-09-25) [stable]
185 Released by Eric Blake, based on CVS version 1.4.6a
187 ** Fix regression from 1.4.5 in handling a file that ends in a macro
188 expansion without arguments instead of a newline.
190 ** The define and pushdef macros now warn when the first argument is not
191 a string, rather than silently doing nothing.
193 ** Standard input can now be read more than once, as in 'm4 - file -', and
194 is not closed until all wrapped text is handled. This makes a
195 difference when stdin is not a regular file, and also fixes bugs when
196 using the syscmd or esyscmd macros from wrapped text.
198 ** When standard input is a seekable file, the m4exit, syscmd, and esyscmd
199 macros now restore the current position to the next unread byte rather
200 than discarding an arbitrary amount of buffered data.
202 ** SysV command-line compatibility is no longer a goal of GNU M4; the
203 focus will be instead on POSIX compatibility. This release continues to
204 support previous usage, but adds warnings in areas which will allow a
205 future version of GNU M4 to use its own extensions without being tied to
206 the SysV command line interface.
208 ** The no-op compatibility command line options -B, -N, -S, -T, and
209 --diversions may be withdrawn or assigned new meanings in future
210 releases, so they now issue a warning if used.
212 ** A new command line option -i replaces the compatibility -e as the
213 short spelling of --interactive, for consistency with other GNU tools; a
214 warning is issued if the old spelling is used, and it may be assigned
215 new meaning in future releases.
217 ** A new command line option --debugfile replaces the options -o and
218 --error-output as the preferred spelling. The old options were
219 misleading in their names and inconsistent with other GNU tools; they
220 are still silently accepted, but no longer documented in --help, and may
221 be assigned new meanings in future releases.
223 * Noteworthy changes in Version 1.4.6 (2006-08-25) [stable]
224 Released by Eric Blake, based on CVS version 1.4.5a
226 ** Fix buffer overruns in regexp and patsubst macros when handed a trailing
227 backslash in the replacement text, or when handling \n substitutions
228 beyond the number of \(\) groups.
230 ** Fix memory leak in regexp, patsubst, and changeword macros.
232 ** The format macro now understands %F, %g, and %G.
234 ** When loading frozen files, m4 now exits with status 63 if version
235 mismatch is detected.
237 ** Fix bugs that occurred when invoked with stdout or stderr closed,
238 and detect write failures to stdout or to the target of the debugfile
239 macro. In particular, the syscmd and esyscmd macros can no longer
240 interfere with the debug stream or diversions.
242 ** The m4exit macro now converts values outside the range 0-255 to 1.
244 ** It is now an error if a command-line input file ends in the middle of a
245 comment, matching the behavior of mid-string and mid-argument
248 ** The dnl macro now warns if end of file is encountered instead of a
251 ** The error message when end of file is encountered now uses the file and
252 line where the dangling construct started, rather than `NONE:0:'.
254 ** The debugmode and __file__ macros, and the -s/--synclines option, now
255 show what directory a file was found in when the -I/--include option or
256 M4PATH variable had an effect.
258 ** The changequote and changecom macros now work with 8-bit characters, and
259 quotes and comments that begin with `(' are properly recognized
262 ** The new macro __program__ is added, which allows the input file to issue
263 an error message that resembles messages from m4. Warning and error
264 messages have been reformatted to comply with GNU Coding Standards.
266 ** The errprint, m4wrap, and shift macros are now recognized only with
269 ** The index, substr, translit, regexp, and patsubst macros now produce
270 output when given only one argument, but still warn about a missing
273 ** The patsubst macro now reliably finds zero-length matches at the end
276 * Noteworthy changes in Version 1.4.5 (2006-07-15) [stable]
277 Released by Eric Blake, based on CVS version 1.4.4c
279 ** Fix sysval on BeOS, OS/2, and other systems that store exit status
280 in the low-order byte. Additionally, on Unix platforms, if syscmd was
281 terminated by a signal, sysval now displays the signal number shifted
282 left by eight bits, to match traditional m4 implementations.
284 ** The maketemp macro is no longer subject to platform limitations (such as
285 26 or 32 max files from a given template).
287 ** Frozen files now require that the first directive be V (version), to
288 better diagnose version mismatch. Additionally, if the F directive
289 (builtin function) names an unknown builtin that existed in the m4 that
290 froze the file but not in the current m4 (for example, changeword), the
291 warning is deferred until an attempt is made to actually use the
292 builtin. This allows downgrading from beta m4-1.4o to stable m4-1.4.5
293 without breaking autoconf.
295 ** The format and indir macros are now recognized only with arguments.
297 ** The eval macro no longer crashes on x86 architectures when dividing the
298 minimum integer by -1.
300 ** On systems with ecvt and fcvt, format no longer truncates trailing
301 zeroes on integers printed with %.0f. On systems without these
302 functions, format is no longer subject to a buffer overflow that
303 permitted arbitrary code execution.
305 ** On native Windows builds, the macro __windows__ is provided instead of
306 __unix__. Likewise, on OS/2 builds, the macro __os2__ is provided.
307 This allows input files to determine when syscmd might behave
310 ** Fix bug in 1.4.3 patch to use \n line-endings that did not work for
313 ** When given the empty string or 0, undivert is now documented as a no-op
314 rather than closing stdout, warning about a non-existent file, or trying
315 to read a directory as a file.
317 ** Many documentation improvements. Also, the manual is now distributed
318 under FDL 1.2, rather than a stricter verbatim-only license.
320 ** Raise the -L (--nesting-limit) command line option limit from 250 to
323 ** The decr, incr, divert, m4exit, and substr macros treat an empty number
324 as 0, issue a warning, and expand as normal; rather than issuing an
325 error and expanding to the empty string.
327 ** The eval macro now treats an empty radix argument as 10, handles radix 1,
328 and treats the width argument as number of digits excluding the sign,
329 for compatibility with other m4 implementations.
331 ** The ifdef, divert, m4exit, substr, and translit macros now correctly
332 ignore extra arguments.
334 ** The popdef and undefine macros now correctly accept multiple arguments.
336 ** Although changeword is on its last leg, if enabled, it now reverts to the
337 default (faster) regexp when passed the empty string.
339 ** The regexp and substr macros now warn and ignore a trailing backslash in
340 the replacement, and warn on \n for n larger than the number of
341 sub-expressions in the regexp.
343 * Noteworthy changes in Version 1.4.4b (2006-06-17) [beta]
344 Released by Eric Blake, based on CVS version 1.4.4a
346 ** Fix a recursive push_string crashing bug, which affected changequote of
347 three or more characters on some compilers.
349 ** Use automake to fix build portability issues.
351 ** Fix a recursive m4wrap crashing bug.
353 ** Fix a 1 in 2**32 hash crashing bug.
355 ** Tracing a macro by name is now persistent, even if the macro is
356 subsequently undefined or redefined. The traceon and traceoff macros no
357 longer warn about undefined symbols. This solves a crash when using
358 indir on an undefined macro traced with the -t option, as well as an
359 incorrect result of ifdef. Furthermore, tracing is no longer
360 transferred with builtins, solving the bug of "m4 -tm4_eval" failing to
361 give trace output on the input
362 "define(`m4_eval',defn(`eval'))m4_eval(1)".
364 ** Fix a crash when a macro is undefined while collecting its arguments, by
365 always using the definition that was in effect before argument
366 collection. This behavior matches the C pre-processor, and means that
367 the sequence "define(`f',`1')f(define(`f',`2'))f" is now documented to
368 result in "12", rather than the previously undocumented "22".
370 ** Update the regex engine to fix several bugs.
372 ** Fix a potential crash on machines where char is signed.
374 * Noteworthy changes in Version 1.4.4 (Oct 2005) [stable]
375 Released by Gary V. Vaughan
377 ** ./configure --infodir=/usr/share/info now works correctly.
379 ** When any file named on the command line is missing exit with status 1.
381 * Noteworthy changes in Version 1.4.3 (Mar 2005) [stable]
382 Released by Gary V. Vaughan
384 ** DESTDIR installs now work correctly.
386 ** Don't segfault with uncompilable regexps to changeword().
388 ** Always use \n line-endings for frozen files (fixes a Windows bug).
390 ** Portability fix for systems lacking mkstemp(3).
392 ** Approximately 20% speed up in the common case of usage with autoconf.
394 ** Supported on QNX 6.3.
396 * Noteworthy changes in Version 1.4.2 (Aug 2004) [stable]
397 Released by Paul Eggert
399 ** No user visible changes; portability bug fixes only.
401 * Noteworthy changes in Version 1.4.1 (Jun 2004) [stable]
402 Released by Paul Eggert
404 ** maketemp now creates an empty file with the given name, instead of merely
405 returning the name of a nonexistent file. This closes a security hole.
407 * Noteworthy changes in Version 1.4 (Oct 1994) [stable]
408 Released by Franc,ois Pinard
410 ** (No user visible changes)
413 Version 1.3 - September 1994, by Franc,ois Pinard
415 * Diversions are created as needed. Option `-N' is still accepted, but
416 otherwise ignored. Users should use only negative diversion numbers,
417 instead of high positive numbers, for diverting to nowhere.
419 * Diversions should also work faster. No temporary files will be needed
420 at all if all diversions taken altogether do not use more than 512K.
422 * Frozen state files may be produced with the `--freeze-state' (-F)
423 option and later brought back through the `--reload-state' (-R) option.
425 Version 1.2 - July 1994, by Franc,ois Pinard
427 * In patsubst(STRING, REGEXP, REPLACEMENT), \& in REPLACEMENT has been
428 changed to represent this part of STRING matched by the whole REGEXP,
429 instead of the whole STRING as before. \0 does the same, but emits a
430 diagnostic saying it will disappear in some subsequent release.
432 * eval(EXPR) emits a diagnostic if EXPR has suffixed crumb. The same for
433 other numeric conversions in incr(), decr(), divert(), etc.
435 * `--fatal-warnings' (-E) stops execution at first warning.
437 * `--nesting-limit=LEVEL' (-L LEVEL) sets a limit to macro nesting.
438 It is initially fixed at 250.
440 * `--word-regexp=REGEXP' (-W REGEXP) modifies macro name syntax, like
441 does the new `changeword(REGEXP)' macro. This feature is experimental,
442 tell me your opinions about it. You do need --enable-changeword at
443 configure time to get these things. Do *not* depend on them yet.
445 * Trace output format is scannable by GNU Emacs' next-error function.
447 * Stack overflow is detected and diagnosed on some capable systems.
449 * Various bugs have been corrected, m4 should be more portable. See the
450 ChangeLog for details.
452 Version 1.1 - November 1993, by Franc,ois Pinard
454 Changes which might affect existing GNU m4 scripts:
456 * Option `-V' has been removed, use `--version' instead. `--version'
457 writes on standard output instead of standard error, and inhibits any
460 * `--no-gnu-extensions' has been renamed `--traditional'.
462 * In `eval', `^' used to indicate exponentiation, use `**' instead.
464 * The automatic undiversion which takes place at end of all input is
465 forced into the main output stream.
467 Changes which are unlikely to affect existing scripts:
469 * `--help' prints an usage summary on standard output. Script execution
472 * `--prefix-builtins' (-P) prefixes all builtin macros by `m4_'.
474 * Most builtin macros for which arguments are mandatory, called without
475 any arguments, are no more recognized as builtin macros: they are
476 consequently copied verbatim to the output stream.
478 * `define' and `pushdef' are usable with only one argument, they give
479 this argument an empty definition.
481 * `eval' new operators for binary representation handling: `^' for
482 exclusive-or, `~' for the bitwise negation, `<<' and `>>' for shifts.
484 * `eval' recognizes the notation 0bDIGITS for binary numbers and the
485 notation 0rRADIX:DIGITS for numbers in any radix from 1 to 36.
487 Version 1.0.3 - December 1992, by Franc,ois Pinard
489 Changes for the user:
491 * `dnl' outputs a diagnostic if immediately followed by `('. Usually,
492 `dnl' is followed by newline or whitespace.
494 * `ifelse' accepts without complaining the common idiom of having only
495 one argument. This is useful for introducing long comments.
497 * `eval' always expresses values as signed, whatever the radix.
499 * M4OPTS environment variable is no longer obeyed.
501 * `--no-warnings' option is renamed `--silent'.
503 * Debug lines use a new format more compatible with GNU standards.
505 * Various bugs have been corrected. See the ChangeLog for details.
507 Changes for the installer:
509 * GNU m4 now uses an Autoconf-generated configure script, and should be
510 more easily portable in many ways. (Cray is not supported yet).
512 * `make check' has been made more portable, expect no errors.
514 Changes for the programmer:
516 * Sources have been fully reindented to comply with GNU standards, and
517 cleaned up in many ways.
519 * Sources have been protoized. Non-ANSI compilers are automatically
520 detected, then sources are unprotoized on the fly before compilation.
522 * GNU m4 uses newer versions of obstack, regex, getopt, etc.
524 Version 1.0 - October 1991, by Rene' Seindal
526 * Uses GNU configure, taken from the gdb distribution.
528 * Uses GNU getopt(), with long option names.
530 * The -Q/+quiet option is added, which suppresses warnings about missing
531 or superflous arguments to built-in macros.
533 * Added default options via the M4OPTS environment variable.
535 * Several minor bugs have been fixed.
537 Version 0.99 - July 1991, by Rene' Seindal
539 * The builtins `incr' and `decr' are now implemented without use of
542 * The builtin `indir' is added, to allow for indirect macro calls
543 (allows use of "illegal" macro names).
545 * The debugging and tracing facilities has been enhanced considerably.
546 See the manual for details.
548 * The -tMACRO option is added, marks MACRO for tracing as soon as it
551 * Builtins are traced after renaming iff they were before.
553 * Named files can now be undiverted.
555 * The -Nnum option can be used to increase the number of divertions
558 * Calling changecom without arguments now disables all comment handling.
560 * A bug in `dnl' is fixed.
562 * A bug in the multi-character quoting code is fixed.
564 * Several typos in the manual has been corrected. More probably persist.
566 Version 0.75 - November 1990, by Rene' Seindal
568 * Implemented search path for include files (-I option and M4PATH
569 environment variable).
571 * Implemented builtin `format' for printf-like formatting.
573 * Implemented builtin `regexp' for searching for regular expressions.
575 * Implemented builtin `patsubst' for substitution with regular
578 * Implemented builtin `esyscmd', which expands to a shell commands output.
580 * Implemented `__file__' and `__line__' for use in error messages.
582 * Implemented character ranges in `translit'.
584 * Implemented control over debugging output.
586 * Implemented multi-character quotes.
588 * Implemented multi-character comment delimiters.
590 * Changed predefined macro `gnu' to `__gnu__'.
592 * Changed predefined macro `unix' to `__unix__', when the -G option is
593 not used. With -G, `unix' is still defined.
595 * Added program name to error messages.
597 * Fixed two missing null bytes bugs.
599 Version 0.50 - January 1990, by Rene' Seindal
601 * Initial beta release.