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