summaryrefslogtreecommitdiff
path: root/m4/sanity.m4
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-11-27 21:46:36 +0100
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-11-27 22:00:33 +0100
commite9a942a19485b83690596cc8ae375b86777eaf9e (patch)
treeefec20b24e2f6f4bbd803d1f53bd207effdac864 /m4/sanity.m4
parent21072002ed61ffc230faab3fa3f0ef720b436965 (diff)
downloadautomake-e9a942a19485b83690596cc8ae375b86777eaf9e.tar.gz
Cope with whitespace in $MISSING and $install_sh.
* configure.ac (am_AUTOHEADER): New substitution, save the value of $AUTOHEADER before AM_INIT_AUTOMAKE may add $MISSING. * tests/defs.in: Use am_AUTOHEADER. * lib/am/install.am: Fix typo. * m4/install-sh.m4 (AM_PROG_INSTALL_SH): Add suitable single-quote quoting to install_sh, but only if needed. * m4/missing.m4 (AM_MISSING_HAS_RUN): Add suitable double-quote quoting to MISSING, but only if needed. * m4/sanity.m4 (AM_SANITY_CHECK): Abort configure if `pwd` or $srcdir contain shell meta-characters that cannot be handled; space and tab are allowed in the former only. * tests/sanity.test: New test. * tests/Makefile.am: Adjust. * NEWS: Update. Reports by Jim Meyering and others. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'm4/sanity.m4')
-rw-r--r--m4/sanity.m421
1 files changed, 17 insertions, 4 deletions
diff --git a/m4/sanity.m4 b/m4/sanity.m4
index 2e76b10d7..3d2f30432 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -1,13 +1,13 @@
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# serial 4
+# serial 5
# AM_SANITY_CHECK
# ---------------
@@ -16,16 +16,29 @@ AC_DEFUN([AM_SANITY_CHECK],
# Just in case
sleep 1
echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t $srcdir/configure conftest.file`
+ set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \