[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: moving $(mkdir_p) from automake to autoconf
From: |
Ralf Wildenhues |
Subject: |
Re: moving $(mkdir_p) from automake to autoconf |
Date: |
Thu, 11 May 2006 15:38:31 +0200 |
User-agent: |
Mutt/1.5.11 |
Hi Paul,
* Paul Eggert wrote on Thu, May 11, 2006 at 01:53:12AM CEST:
> Ralf Wildenhues <address@hidden> writes:
>
> > http://lists.gnu.org/archive/html/bug-autoconf/2006-04/msg00041.html
>
> I like that suggestion, found a few issues with it, and came up with
> the following further patch, which I installed.
Thanks for doing this work!
> Hmm, but I now see
> that my version may cause clashes between AC_PROG_MKDIR_P and
> AM_PROG_MKDIR_P. I'll look into that now. Perhaps AC_PROG_MKDIR_P
> should set a new output variable MKDIR_P rather than Automake's
> mkdir_p?
Yes, I think using MKDIR_P would be a good idea. Currently, the
variable MKDIR_P is used by a few packages only. So this danger
scenario is not so great: we like AC_PROG_MKDIR_P, get used to it,
so we add macros that AC_REQUIRE it, so it will be used even if the
user doesn't select that consciously, so it conflicts with some
other, third-party MKDIR_P.
OTOH, with mkdir_p you have the Automake interaction scenario: say,
something in configure.ac causes AC_PROG_MKDIR_P to be emitted before
AM_INIT_AUTOMAKE, which itself requires AM_PROG_MKDIR_P; since that
may be from an older Automake release, it can overwrite $mkdir_p with
a value that is not valid for uses outside of Makefiles. But your
documentation now does not mention this restriction (and neither does
the Autoconf $mkdir_p setting).
There is also the reverse scenario, should Automake be newer and provide
an install-sh that fixes a bug that the used Autoconf version has: the
Autoconf macro happily overwrites $mkdir_p, regardless of its previous
setting.
> Also, automake should be updated to use the new install-sh. I'll send
> off a message to automake-patches after I've sorted out the name space
> collision.
Good, thanks. But please note that it's not robust to change the
version in Autoconf: the `make update' step will not be able to detect
that the Autoconf copy has committed changes that the Automake copy
doesn't.
A couple of minor nits inline.
Cheers,
Ralf
> 2006-05-10 Paul Eggert <address@hidden>
>
> * NEWS: New macro AC_PROG__MKDIR_P. AS_MKDIR_P is now more robust.
^
Typo: extra underscore here.
> * config/install-sh: Don't use 'path' to talk about file names,
> as per GNU coding standards. Close a race condition reported by Ralf
> Wildenhues and Stepan Kasal. There is still a race condition
> on hosts that predate POSIX 1003.1-1992, but we can't help this.
Did you move back to using POSIX instead of Posix now, or was that
convention for the manual only?
> Don't mishandle weird characters like space on pre-POSIX hosts.
> Invoke mkdir at most once per dir arg on pre-POSIX hosts.
*snip*
> Index: doc/autoconf.texi
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
> retrieving revision 1.1014
> retrieving revision 1.1016
> diff -p -u -r1.1014 -r1.1016
> --- doc/autoconf.texi 4 May 2006 07:08:19 -0000 1.1014
> +++ doc/autoconf.texi 10 May 2006 23:42:59 -0000 1.1016
> @@ -3521,6 +3521,29 @@ not found in standard @code{install} pro
> @file{Makefile.in} files.
> @end defmac
>
> address@hidden AC_PROG_MKDIR_P
> address@hidden
> address@hidden mkdir_p
> +Set output variable @code{mkdir_p} to a command that ensures that for
> +each argument, a directory named by this argument exists, creating it
> +and its parent directories if needed. The command is checked to make
> +sure that it is thread-safe (@pxref{Limitations of Usual Tools}).
> +
> +This macro uses the @samp{mkdir -p} command if possible. Otherwise, it
> +falls back on @code{$INSTALL}, so your package should
> +contain @file{install-sh} as described under @code{AC_PROG_INSTALL}.
> +
> +This macro is related to the @code{AS_MKDIR_P} macro (@pxref{Programming
> +in M4sh}), but it sets an output variable intended for use in other
> +files, whereas @code{AS_MKDIR_P} is intended for use in scripts like
> address@hidden Also, @code{AS_MKDIR_P} does not accept options,
> +but if you are willing to assume Posix 1003.2-1992 or later, a
> address@hidden can use options, e.g., a makefile might invoke
> address@hidden(mkdir_p) -m 0 dir}.
> address@hidden defmac
> +
> +This macro differs from
There is something missing here.
> +
> @defmac AC_PROG_LEX
> @acindex{PROG_LEX}
> @ovindex LEX
> @@ -9726,6 +9749,9 @@ succeeds if @var{file-name} is a symboli
> even though Posix is unclear whether @samp{mkdir -p} should
> succeed in that case. If creation of @var{file-name} fails, exit the
> script.
> +
> +Also see the @code{AC_PROG_MKDIR_P} macro (@pxref{Limitations of Usual
> +Tools}).
That reference should point to {Particular Programs}, I think.
> @end defmac
>
> @defmac AS_SHELL_SANITIZE
*snip*
> Index: lib/m4sugar/m4sh.m4
> ===================================================================
> RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sh.m4,v
> retrieving revision 1.184
> diff -p -u -r1.184 m4sh.m4
> --- lib/m4sugar/m4sh.m4 25 Apr 2006 12:27:45 -0000 1.184
> +++ lib/m4sugar/m4sh.m4 10 May 2006 22:58:31 -0000
> @@ -901,17 +901,24 @@ $as_ln_s $1 $2
> # Emulate `mkdir -p' with plain `mkdir'.
> m4_define([AS_MKDIR_P],
> [AS_REQUIRE([_$0_PREPARE])dnl
> -{ if $as_mkdir_p; then
> - test -d $1 || mkdir -p $1
> - else
> - as_dir=$1
> +{ as_dir=$1
> + case $as_dir in #(
> + -*) as_dir=./$as_dir;;
> + esac
> + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
> as_dirs=
> - while test ! -d "$as_dir"; do
> - as_dirs="$as_dir $as_dirs"
> + while :; do
> + case $as_dir in #(
> + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
> + *) as_qdir=$as_dir;;
> + esac
> + as_dirs="'$as_qdir' $as_dirs"
> as_dir=`AS_DIRNAME("$as_dir")`
> + test -d "$as_dir" && break
> done
> - test ! -n "$as_dirs" || mkdir $as_dirs
> - fi || AS_ERROR([cannot create directory $1]); }dnl
> + test -z "$as_dirs" || eval "mkdir $as_dirs"
> + } || test -d "$as_dir" || AS_ERROR([cannot create directory $as_dir]); }dnl
> + # The last "test -d" is in case some other process made the directory.
There are probably uses in the wild that do
AS_MKDIR_P(bla) || AS_ERROR
(we just killed one in the Autoconf tree itself), which is also the
reason for the final `dnl'; the added comment at the end destroys this.
Even if we already fail, I don't think that's very nice toward our users.
> ])# AS_MKDIR_P