From: Akim Demaille Date: Fri, 10 Nov 2000 10:14:44 +0000 (+0000) Subject: * m4sh.m4 (AS_MKDIR_P, AS_DIRNAME_SED): Don't shell quote $1. X-Git-Tag: autoconf-2.50~450 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9fd1e4edc135dc2143a79bf0a4efd0a057e714c;p=thirdparty%2Fautoconf.git * m4sh.m4 (AS_MKDIR_P, AS_DIRNAME_SED): Don't shell quote $1. Adjust callers. Reported by Paul Eggert. * tests/m4sh.at: Sort. --- diff --git a/ChangeLog b/ChangeLog index b26de77ae..2ada205cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2000-11-10 Akim Demaille + + * m4sh.m4 (AS_MKDIR_P, AS_DIRNAME_SED): Don't shell quote $1. + Adjust callers. + Reported by Paul Eggert. + * tests/m4sh.at: Sort. + 2000-11-09 Pavel Roskin * install-sh: Use ":" instead of "true". diff --git a/acgeneral.m4 b/acgeneral.m4 index b8f444ce4..45fe472ef 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -2698,7 +2698,7 @@ dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. echo $ECHO_N "checking for prefix by $ECHO_C" >&AC_FD_MSG AC_PATH_PROG(m4_quote(AC_Prog), [$1]) if test -n "$ac_cv_path_[]AC_Prog"; then - prefix=`AS_DIRNAME([$ac_cv_path_[]AC_Prog])` + prefix=`AS_DIRNAME(["$ac_cv_path_[]AC_Prog"])` fi fi m4_popdef([AC_Prog])dnl @@ -4273,9 +4273,9 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - ac_dir=`AS_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME(["$ac_file"])` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AS_MKDIR_P("$ac_dir") + AS_MKDIR_P(["$ac_dir"]) ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'` @@ -4595,9 +4595,9 @@ cat >>$CONFIG_STATUS <<\EOF if cmp -s $ac_file $tmp/config.h 2>/dev/null; then echo "$ac_file is unchanged" else - ac_dir=`AS_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME(["$ac_file"])` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AS_MKDIR_P("$ac_dir") + AS_MKDIR_P(["$ac_dir"]) fi rm -f $ac_file mv $tmp/config.h $ac_file @@ -4646,9 +4646,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue rm -f $ac_dest # Make relative symlinks. - ac_dest_dir=`AS_DIRNAME("$ac_dest")` + ac_dest_dir=`AS_DIRNAME(["$ac_dest"])` if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - AS_MKDIR_P("$ac_dest_dir") + AS_MKDIR_P(["$ac_dest_dir"]) ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dest_dir_suffix. ac_dots=`echo $ac_dest_dir_suffix|sed 's,/[[^/]]*,../,g'` @@ -4757,10 +4757,10 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], echo configuring in $ac_subdir case $srcdir in .) ;; - *) AS_MKDIR_P(./$ac_subdir) + *) AS_MKDIR_P(["./$ac_subdir"]) if test -d ./$ac_subdir; then :; else - AC_MSG_ERROR(cannot create `pwd`/$ac_subdir) + AC_MSG_ERROR([cannot create `pwd`/$ac_subdir]) fi ;; esac diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index b8f444ce4..45fe472ef 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -2698,7 +2698,7 @@ dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. echo $ECHO_N "checking for prefix by $ECHO_C" >&AC_FD_MSG AC_PATH_PROG(m4_quote(AC_Prog), [$1]) if test -n "$ac_cv_path_[]AC_Prog"; then - prefix=`AS_DIRNAME([$ac_cv_path_[]AC_Prog])` + prefix=`AS_DIRNAME(["$ac_cv_path_[]AC_Prog"])` fi fi m4_popdef([AC_Prog])dnl @@ -4273,9 +4273,9 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue esac # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. - ac_dir=`AS_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME(["$ac_file"])` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AS_MKDIR_P("$ac_dir") + AS_MKDIR_P(["$ac_dir"]) ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dir_suffix. ac_dots=`echo "$ac_dir_suffix" | sed 's,/[[^/]]*,../,g'` @@ -4595,9 +4595,9 @@ cat >>$CONFIG_STATUS <<\EOF if cmp -s $ac_file $tmp/config.h 2>/dev/null; then echo "$ac_file is unchanged" else - ac_dir=`AS_DIRNAME("$ac_file")` + ac_dir=`AS_DIRNAME(["$ac_file"])` if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then - AS_MKDIR_P("$ac_dir") + AS_MKDIR_P(["$ac_dir"]) fi rm -f $ac_file mv $tmp/config.h $ac_file @@ -4646,9 +4646,9 @@ for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue rm -f $ac_dest # Make relative symlinks. - ac_dest_dir=`AS_DIRNAME("$ac_dest")` + ac_dest_dir=`AS_DIRNAME(["$ac_dest"])` if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then - AS_MKDIR_P("$ac_dest_dir") + AS_MKDIR_P(["$ac_dest_dir"]) ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's,^\./,,'`" # A "../" for each directory in $ac_dest_dir_suffix. ac_dots=`echo $ac_dest_dir_suffix|sed 's,/[[^/]]*,../,g'` @@ -4757,10 +4757,10 @@ AC_PROVIDE_IFELSE([AC_PROG_INSTALL], echo configuring in $ac_subdir case $srcdir in .) ;; - *) AS_MKDIR_P(./$ac_subdir) + *) AS_MKDIR_P(["./$ac_subdir"]) if test -d ./$ac_subdir; then :; else - AC_MSG_ERROR(cannot create `pwd`/$ac_subdir) + AC_MSG_ERROR([cannot create `pwd`/$ac_subdir]) fi ;; esac diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4 index e62e17013..7817aeeae 100644 --- a/lib/m4sugar/m4sh.m4 +++ b/lib/m4sugar/m4sh.m4 @@ -133,7 +133,7 @@ m4_define([AS_MKDIR_P], [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; *) ac_incr_dir=.;; esac -ac_dummy="$1" +ac_dummy=$1 for ac_mkdir_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir test -d $ac_incr_dir || mkdir $ac_incr_dir @@ -160,7 +160,7 @@ m4_define([AS_DIRNAME_EXPR], . : '\(.\)']) m4_define([AS_DIRNAME_SED], -[echo "X[]$1" | +[echo X[]$1 | sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } diff --git a/m4sh.m4 b/m4sh.m4 index e62e17013..7817aeeae 100644 --- a/m4sh.m4 +++ b/m4sh.m4 @@ -133,7 +133,7 @@ m4_define([AS_MKDIR_P], [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;; *) ac_incr_dir=.;; esac -ac_dummy="$1" +ac_dummy=$1 for ac_mkdir_dir in `IFS=/; set X $ac_dummy; shift; echo "$[@]"`; do ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir test -d $ac_incr_dir || mkdir $ac_incr_dir @@ -160,7 +160,7 @@ m4_define([AS_DIRNAME_EXPR], . : '\(.\)']) m4_define([AS_DIRNAME_SED], -[echo "X[]$1" | +[echo X[]$1 | sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } diff --git a/tests/m4sh.at b/tests/m4sh.at index d1ab5be96..5e6e2e7a3 100644 --- a/tests/m4sh.at +++ b/tests/m4sh.at @@ -7,36 +7,6 @@ Autoshell. EOF -## ------------ ## -## AS_MKDIR_P. ## -## ------------ ## - -# Build nested dirs. - -AT_SETUP(AC_SHELL_MKDIR_P) - -AT_DATA(configure.in, -[[AC_PLAIN_SCRIPT -pwd=`pwd` -set -e -# Absolute -AS_MKDIR_P($pwd/1/2/3/4/5/6) -test -d $pwd/1/2/3/4/5/6 || - AC_MSG_ERROR([$pwd/1/2/3/4/5/6 has not been properly created]) -# Relative -AS_MKDIR_P(a/b/c/d/e/f) -test -d a/b/c/d/e/f || - AC_MSG_ERROR([a/b/c/d/e/f has not been properly created]) -AS_EXIT(0) -]]) - -AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) -AT_CHECK([./configure], 0) - -AT_CLEANUP(configure 1 a) - - - ## ----------------------------- ## ## AS_DIRNAME & AS_DIRNAME_SED. ## ## ----------------------------- ## @@ -102,7 +72,37 @@ AS_DIRNAME_SED_TEST([../../2//3/], [../../2]) AS_EXIT(0) ]]) -AT_CHECK([../autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) AT_CHECK([./configure], 0) AT_CLEANUP(configure) + + + +## ------------ ## +## AS_MKDIR_P. ## +## ------------ ## + +# Build nested dirs. + +AT_SETUP(AC_SHELL_MKDIR_P) + +AT_DATA(configure.in, +[[AC_PLAIN_SCRIPT +pwd=`pwd` +set -e +# Absolute +AS_MKDIR_P(["$pwd/1/2/3/4/5/6"]) +test -d "$pwd/1/2/3/4/5/6" || + AC_MSG_ERROR([$pwd/1/2/3/4/5/6 has not been properly created]) +# Relative +AS_MKDIR_P(["a/b/c/d/e/f"]) +test -d a/b/c/d/e/f || + AC_MSG_ERROR([a/b/c/d/e/f has not been properly created]) +AS_EXIT(0) +]]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 0, [], []) +AT_CHECK([./configure], 0) + +AT_CLEANUP(configure 1 a)