+2008-11-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Jim Meyering <jim@meyering.net>
+
+ 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.
+
2008-11-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Let `missing' also work with versioned and prefixed programs.
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
- The `missing' script works better with versioned tool names.
+ - Automake's early configure-time sanity check now diagnoses an
+ unsafe absolute source directory name and makes configure fail.
+
+ - The Automake macros and rules cope better with whitespace in the
+ current directory name, as long as the relative path to `configure'
+ does not contain whitespace. To this end, the values of `$(MISSING)'
+ and `$(install_sh)' may contain suitable quoting, and their expansion
+ might need `eval'uation if used outside of a makefile. These
+ undocumented variables may be used in several documented macros such
+ as $(AUTOCONF) or $(MAKEINFO).
+
Bugs fixed in 1.10a:
* Long standing bugs:
INSTALL_DATA
INSTALL_SCRIPT
INSTALL_PROGRAM
+am_AUTOHEADER
am_AUTOCONF
build_os
build_vendor
# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
# way we can run Autoconf tests from configure (or from the test
-# suite) without being bothered by `missing'.
+# suite) without being bothered by `missing'. Likewise for autoheader.
am_AUTOCONF="${AUTOCONF-autoconf}"
+am_AUTOHEADER="${AUTOHEADER-autoheader}"
+
am__api_version='1.10a'
# 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]*)
+ { { $as_echo "$as_me:$LINENO: error: unsafe absolute working directory name" >&5
+$as_echo "$as_me: error: unsafe absolute working directory name" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ { { $as_echo "$as_me:$LINENO: error: unsafe srcdir value: \`$srcdir'" >&5
+$as_echo "$as_me: error: unsafe srcdir value: \`$srcdir'" >&2;}
+ { (exit 1); exit 1; }; };;
+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" \
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
# way we can run Autoconf tests from configure (or from the test
-# suite) without being bothered by `missing'.
+# suite) without being bothered by `missing'. Likewise for autoheader.
AC_SUBST([am_AUTOCONF], ["${AUTOCONF-autoconf}"])
+AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"])
AM_INIT_AUTOMAKE([1.10a dist-bzip2 filename-length-max=99 color-tests])
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+## Copyright (C) 2001, 2002, 2003, 2004, 2006, 2008 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
## directory.
.MAKE .PHONY: install-strip
install-strip:
-## Beware that they are two variables used to install programs:
+## Beware that there are two variables used to install programs:
## INSTALL_PROGRAM is used for ordinary *_PROGRAMS
## install_sh_PROGRAM is used for nobase_*_PROGRAMS (because install-sh
## creates directories)
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
## -*- Autoconf -*-
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 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,
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
AC_SUBST(install_sh)])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 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 5
+# serial 6
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
# 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
# ---------------
# 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" \
reqd.test \
reqd2.test \
rulepat.test \
+sanity.test \
scripts.test \
seenc.test \
sinclude.test \
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
am_AUTOCONF = @am_AUTOCONF@
+am_AUTOHEADER = @am_AUTOHEADER@
am__leading_dot = @am__leading_dot@
am__tar = @am__tar@
am__untar = @am__untar@
reqd.test \
reqd2.test \
rulepat.test \
+sanity.test \
scripts.test \
seenc.test \
sinclude.test \
test -z "$PERL" && PERL='@PERL@'
test -z "$MAKE" && MAKE=make
test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@"
-test -z "$AUTOHEADER" && AUTOHEADER="@AUTOHEADER@"
+test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@"
test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
test -z "$MISSING" && MISSING=`pwd`/../lib/missing
# Use -Werror because this also turns some Perl warnings into error.
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2008 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
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Unsafe absolute directory names should be diagnosed.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir 'unsafe$'
+cd 'unsafe$'
+
+cat > configure.in << 'END'
+AC_INIT([sanity], [1.0])
+AM_INIT_AUTOMAKE([foreign])
+AC_OUTPUT(Makefile)
+END
+
+cp ../install-sh ../missing .
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr
+grep 'unsafe absolute working directory' stderr
+
+cd ..
+mkdir build
+cd build
+../unsafe$/configure 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr
+grep 'unsafe srcdir' stderr
+: