]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Fix regression that broke Automake ‘make check’
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 1 Aug 2020 18:47:10 +0000 (11:47 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 1 Aug 2020 18:47:42 +0000 (11:47 -0700)
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.

bin/autoheader.in
doc/autoconf.texi

index 7d07fad13f4689e78875114fb13eddb472a54956..bd824ea3f84556743bbca58b28846b2e2a212e61 100644 (file)
@@ -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};
+           }
        }
     }
 
index 6ad4dca1bbe2b0300224ab9e7cd1f2ff7d5ab1ec..70d37834c1cb7a8bfc62e1421b06a18cb873bff7 100644 (file)
@@ -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: