]> git.ipfire.org Git - thirdparty/autoconf.git/commit
mktmpdir: Ensure that $tmp is always an absolute pathname.
authorZack Weinberg <zackw@panix.com>
Thu, 24 Sep 2020 20:06:23 +0000 (16:06 -0400)
committerZack Weinberg <zackw@panix.com>
Thu, 24 Sep 2020 20:06:23 +0000 (16:06 -0400)
commit730f382a92ec897b3142fdac4dc1f3c8a9a67909
tree83dc2ae6bd5d3cdc408886aa8d223ba4e85189f1
parentbe818a3b94a9d5ae21e649455477ecff5e465e47
mktmpdir: Ensure that $tmp is always an absolute pathname.

Several autotools programs use ‘do’ to evaluate Perl code
generated into a file in the temporary directory created by
Autom4te::General::mktmpdir.  If the environment variable
TMPDIR is a relative path, mktmpdir will set $tmp to a
relative path and we’ll end up trying to ‘do’ a relative
path, which searches for the file in @INC.  This doesn’t
work under perl 5.26 or later, because ‘.’ was removed
from @INC in that version (for security reasons).

Ensure that mktmpdir sets $tmp to an absolute pathname.
Also use File::Temp::tempdir to create the temporary
directory, instead of shelling out to ‘mktemp -d’;
this eliminates a subprocess and means we don’t have
to worry about cleaning up the directory on exit.

Problem found by Kent Fredric and reported as
<https://bugs.gentoo.org/625576>.
Supersedes Gentoo’s autoconf-2.69-perl-5.26-2.patch.

* lib/Autom4te/General.pm
  (mktmpdir): Use File::Temp to create temporary directory.
  Ensure that $tmp is an absolute path.
  (END): No need to clean up $tmp.

* tests/tools.at (autotools and relative TMPDIR): New test.
lib/Autom4te/General.pm
tests/tools.at