From: Eric Blake Date: Fri, 20 Oct 2006 01:34:32 +0000 (+0000) Subject: * lib/m4sugar/m4sugar.m4 (m4_mkstemp): New macro. X-Git-Tag: AUTOCONF-2.60b~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a542d202ed9f26846c013739f935281c94569598;p=thirdparty%2Fautoconf.git * lib/m4sugar/m4sugar.m4 (m4_mkstemp): New macro. (m4_maketemp): Avoid warnings with M4 1.9a. * lib/emacs/autoconf-mode.el (autoconf-font-lock-keywords): Color m4_mkstemp. * doc/autoconf.texi (Redefined M4 Macros): Document m4_mkstemp. * NEWS: Likewise. --- diff --git a/ChangeLog b/ChangeLog index 6aaa1e4c..d9878897 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-10-19 Eric Blake + + * lib/m4sugar/m4sugar.m4 (m4_mkstemp): New macro. + (m4_maketemp): Avoid warnings with M4 1.9a. + * lib/emacs/autoconf-mode.el (autoconf-font-lock-keywords): Color + m4_mkstemp. + * doc/autoconf.texi (Redefined M4 Macros): Document m4_mkstemp. + * NEWS: Likewise. + 2006-10-16 Eric Blake * doc/autoconf.texi (Setting Output Variables): Fix typo. diff --git a/NEWS b/NEWS index c48eaf19..03054231 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,12 @@ ** GNU M4 1.4.7 or later is now recommended. +** m4_mkstemp + New M4sugar macro, which is more secure than the POSIX M4 maketemp. + +** m4_maketemp + Now an alias for m4_mkstemp. + * Major changes in Autoconf 2.60a (2006-08-25) ** GNU M4 1.4.6 or later is now recommended. At least one "make check" diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 64f5908d..1553fdb1 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -9752,7 +9752,6 @@ M4sugar''. @msindex{index} @msindex{indir} @msindex{len} -@msindex{maketemp} @msindex{pushdef} @msindex{shift} @msindex{substr} @@ -9856,6 +9855,20 @@ m4_ifdef([@var{macro}], [m4_undefine([@var{macro}])]) to recover the behavior of the builtin. @end defmac +@defmac m4_maketemp (@var{template}) +@defmacx m4_mkstemp (@var{template}) +@msindex{maketemp} +@msindex{mkstemp} +Posix requires @code{maketemp} to replace the trailing @samp{X} +characters in @var{template} with the process id, without regards to the +existence of a file by that name, but this a security hole. When this +was pointed out to the Posix folks, they agreed to invent a new macro +@code{mkstemp} that always creates a uniquely named file, but not all +versions of @acronym{GNU} M4 support the new macro. In M4sugar, +@code{m4_maketemp} and @code{m4_mkstemp} are synonyms for each other, +and both have the secure semantics regardless of which macro the +underlying M4 provides. +@end defmac @node Looping constructs @@ -19135,4 +19148,6 @@ introduced in this document. @c Local Variables: @c fill-column: 72 @c ispell-local-dictionary: "american" +@c indent-tabs-mode: nil +@c whitespace-check-buffer-indent: nil @c End: diff --git a/lib/emacs/autoconf-mode.el b/lib/emacs/autoconf-mode.el index 3476765a..84eb03f5 100644 --- a/lib/emacs/autoconf-mode.el +++ b/lib/emacs/autoconf-mode.el @@ -6,7 +6,7 @@ ;; This file is part of Autoconf -;; Copyright 2001 Free Software Foundation, Inc. +;; Copyright 2001, 2006 Free Software Foundation, Inc. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -40,7 +40,7 @@ (defvar autoconf-font-lock-keywords `(("\\bdnl \\(.*\\)" 1 font-lock-comment-face t) ("\\$[0-9*#@]" . font-lock-variable-name-face) - ("\\b\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|ivert\\)\\|ix\\)\\)\\b" . font-lock-keyword-face) + ("\\b\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\|kstemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|ivert\\)\\|ix\\)\\)\\b" . font-lock-keyword-face) ("^\\(\\(m4_\\)?define\\|A._DEFUN\\|m4_defun\\)(\\[?\\([A-Za-z0-9_]+\\)" 3 font-lock-function-name-face) "default font-lock-keywords") ) diff --git a/lib/m4sugar/m4sugar.m4 b/lib/m4sugar/m4sugar.m4 index f9e7cd07..a4bfee4e 100644 --- a/lib/m4sugar/m4sugar.m4 +++ b/lib/m4sugar/m4sugar.m4 @@ -140,7 +140,12 @@ m4_rename_m4([indir]) m4_rename_m4([len]) m4_rename([m4exit], [m4_exit]) m4_rename([m4wrap], [m4_wrap]) -m4_rename_m4([maketemp]) +m4_ifdef([mkstemp],dnl added in M4 1.4.8 +[m4_rename_m4([mkstemp]) +m4_copy([m4_mkstemp], [m4_maketemp]) +m4_undefine([maketemp])], +[m4_rename_m4([maketemp]) +m4_copy([m4_maketemp], [m4_mkstemp])]) m4_rename([patsubst], [m4_bpatsubst]) m4_undefine([popdef]) m4_rename_m4([pushdef])