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