diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-01 11:47:10 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2020-08-01 11:47:42 -0700 |
commit | e30ed262092b809899bd545bc418719c5e8a384a (patch) | |
tree | 4d3b37a11af4780209396828b44e598aba3f10ce | |
parent | e9bfc7c7582a6b69bf753f2bea5d4cb1f669759a (diff) | |
download | autoconf-e30ed262092b809899bd545bc418719c5e8a384a.tar.gz |
Fix regression that broke Automake ‘make check’
Problem reported by Ken Moffat (sr#110287); the problem was
introduced in 2016-12-21T16:15:46Z!daniel.kitta@gmail.com.
* bin/autoheader.in (templates_for_header):
When generating warnings about symbols lacking templates,
downgrade template read failure from a fatal error to a warning.
Also, don’t even try to read from a template file whose name has
shell metavariables (which Autoconf 2.50 withdrew support for);
just warn about that, too. These changes cause the Automake
tests to merely generate warnings that are ignored, instead
of failing.
* doc/autoconf.texi (Configuration Files, Configuration Headers)
(Configuration Commands, Configuration Links):
Also document here that the file names should not contain
shell metacharacters, to make this constraint more obvious.
-rw-r--r-- | bin/autoheader.in | 23 | ||||
-rw-r--r-- | doc/autoconf.texi | 16 |
2 files changed, 30 insertions, 9 deletions
diff --git a/bin/autoheader.in b/bin/autoheader.in index 7d07fad1..bd824ea3 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -273,13 +273,24 @@ $out->close; { foreach my $template ("$tmp/config.hin", @config_templates) { - my $in = new Autom4te::XFile ($template, "<"); - - while ($_ = $in->getline) + if ($template =~ /["#\$&'()*;<>?[\\\^`|]/) + { + msg 'syntax', "warning: header template has shell metacharacters: $template"; + } + elsif (! -r $template) + { + msg 'syntax', "warning: cannot read $template: $!"; + } + else { - my ($sym) = /^\#\s*\w+\s+(\w+)/ - or next; - delete $symbol{$sym}; + my $in = new Autom4te::XFile ($template, "<"); + + while ($_ = $in->getline) + { + my ($sym) = /^\#\s*\w+\s+(\w+)/ + or next; + delete $symbol{$sym}; + } } } diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 6ad4dca1..70d37834 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2438,6 +2438,9 @@ AC_CONFIG_FILES([Makefile:boiler/top.mk:boiler/bot.mk] Doing this allows you to keep your file names acceptable to DOS variants, or to prepend and/or append boilerplate to the file. + +The @var{file} names should not contain shell metacharacters. +@xref{Special Chars in Variables}. @end defmac @@ -3297,7 +3300,9 @@ Actions}. Make @code{AC_OUTPUT} create the file(s) in the blank-or-newline-separated list @var{header} containing C preprocessor @code{#define} statements, and replace @samp{@@DEFS@@} in generated files with @option{-DHAVE_CONFIG_H} instead of the value of @code{DEFS}. -The usual name for @var{header} is @file{config.h}. +The usual name for @var{header} is @file{config.h}; +@var{header} should not contain shell metacharacters. +@xref{Special Chars in Variables}. If @var{header} already exists and its contents are identical to what @code{AC_OUTPUT} would put in it, it is left alone. Doing this allows @@ -3617,7 +3622,9 @@ Specify additional shell commands to run at the end of from @command{configure}. Associate the commands with @var{tag}. Since typically the @var{cmds} create a file, @var{tag} should naturally be the name of that file. If needed, the directory hosting -@var{tag} is created. This macro is one of the instantiating macros; +@var{tag} is created. The @var{tag} should not contain shell +metacharacters. @xref{Special Chars in Variables}. +This macro is one of the instantiating macros; see @ref{Configuration Actions}. Here is an unrealistic example: @@ -3676,7 +3683,10 @@ Make @code{AC_OUTPUT} link each of the existing files @var{source} to the corresponding link name @var{dest}. Makes a symbolic link if possible, otherwise a hard link if possible, otherwise a copy. The @var{dest} and @var{source} names should be relative to the top level -source or build directory. This macro is one of the instantiating +source or build directory, and should not contain shell metacharacters. +@xref{Special Chars in Variables}. + +This macro is one of the instantiating macros; see @ref{Configuration Actions}. For example, this call: |