-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 According to Stepan Kasal on 4/1/2006 9:15 AM: > Hello, > I committed Eric's patch, but I added a line of comment to the AT_INIT > code, see below. > +++ lib/autotest/general.m4 1 Apr 2006 16:09:13 -0000 1.200 > @@ -699,7 +699,8 @@ > find $at_group_dir -type d ! -perm -700 -exec chmod u+rwx \{\} \; > rm -fr $at_group_dir > fi > - mkdir $at_group_dir || > + # Be tolerant if the above `rm' was not able to remove the directory. > + AS_MKDIR_P([$at_group_dir]) || > AS_ERROR([cannot create $at_group_dir])
I just noticed that AS_MKDIR_P already does AS_ERROR (fatal to the script) if it fails, so the AS_ERROR in autotest/general.m4 is now redundant with the one built in to m4sh.m4. Also, should we document AS_ERROR and friends in autoconf.texi? Also, AS_MKDIR_P is not threadsafe if mkdir -p is not supported, is that a problem? How about this followup patch for the redundancy in autotest: 2006-04-05 Eric Blake <[EMAIL PROTECTED]> * doc/autoconf.texi (Programming in M4sh): Document that AS_MKDIR_P exits the script on failure. * lib/m4sugar/m4sh.m4 (AS_SHELL_SANITIZE, AS_MESSAGE, AS_WARN) (AS_ERROR, AS_MKDIR_P, _AS_DIRNAME_PREPARE, _AS_MKDIR_P_PREPARE) (_AS_TR_*PREPARE): Improve documentation. * lib/autotest/general.m4: Remove redundant AS_ERROR. Cleanup space followed by tab. - -- Life is short - so eat dessert first! Eric Blake [EMAIL PROTECTED] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.1 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFEM8Rp84KuGfSFAYARAs8QAKDUpzKSWUKstgXMA51wMnqrKIYeugCfSiPp 4rLL4qSq4F/h3euu3nZkIe4= =qVGK -----END PGP SIGNATURE-----
Index: doc/autoconf.texi =================================================================== RCS file: /sources/autoconf/autoconf/doc/autoconf.texi,v retrieving revision 1.982 diff -u -p -r1.982 autoconf.texi --- doc/autoconf.texi 3 Apr 2006 08:06:22 -0000 1.982 +++ doc/autoconf.texi 5 Apr 2006 13:18:11 -0000 @@ -9451,7 +9451,8 @@ except that it is portable to older vers lack support for the @option{-p} option. Also, @code{AS_MKDIR_P} succeeds if @var{file-name} is a symbolic link to an existing directory, even though Posix is unclear whether @samp{mkdir -p} should -succeed in that case. +succeed in that case. If creation of @var{file-name} fails, exit the +script. @end defmac @defmac AS_SHELL_SANITIZE Index: lib/autotest/general.m4 =================================================================== RCS file: /sources/autoconf/autoconf/lib/autotest/general.m4,v retrieving revision 1.202 diff -u -p -r1.202 general.m4 --- lib/autotest/general.m4 3 Apr 2006 04:47:02 -0000 1.202 +++ lib/autotest/general.m4 5 Apr 2006 13:18:12 -0000 @@ -388,16 +388,16 @@ dnl Process *=* last to allow for user s m4_divert_push([PARSE_ARGS_END])dnl *=*) - at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='` - # Reject names that are not valid shell variable names. - expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && - AS_ERROR([invalid variable name: $at_envvar]) - at_value=`echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$at_envvar='$at_value'" - export $at_envvar + at_envvar=`expr "x$at_option" : 'x\([[^=]]*\)='` + # Reject names that are not valid shell variable names. + expr "x$at_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && + AS_ERROR([invalid variable name: $at_envvar]) + at_value=`echo "$at_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$at_envvar='$at_value'" + export $at_envvar # Propagate to debug scripts. - at_debug_args="$at_debug_args $at_option" - ;; + at_debug_args="$at_debug_args $at_option" + ;; *) echo "$as_me: invalid option: $at_option" >&2 echo "Try \`$[0] --help' for more information." >&2 @@ -700,8 +700,7 @@ do rm -fr $at_group_dir fi # Be tolerant if the above `rm' was not able to remove the directory. - AS_MKDIR_P([$at_group_dir]) || - AS_ERROR([cannot create $at_group_dir]) + AS_MKDIR_P([$at_group_dir]) cd $at_group_dir ;; esac @@ -743,7 +742,7 @@ m4_divert_push([TESTS_END])[]dnl run. This means that test suite is improperly designed. Please report this failure to <AT_PACKAGE_BUGREPORT>. _ATEOF - echo "$at_setup_line" >"$at_check_line_file" + echo "$at_setup_line" >"$at_check_line_file" fi at_group_count=`expr 1 + $at_group_count` $at_verbose $ECHO_N "$at_group. $at_setup_line: $ECHO_C" Index: lib/m4sugar/m4sh.m4 =================================================================== RCS file: /sources/autoconf/autoconf/lib/m4sugar/m4sh.m4,v retrieving revision 1.175 diff -u -p -r1.175 m4sh.m4 --- lib/m4sugar/m4sh.m4 5 Apr 2006 08:01:05 -0000 1.175 +++ lib/m4sugar/m4sh.m4 5 Apr 2006 13:18:12 -0000 @@ -316,6 +316,7 @@ $1], [^], [EMAIL PROTECTED]:@ ])])]) # AS_SHELL_SANITIZE # ----------------- +# Sanitize the shell for use by Autoconf. m4_defun([AS_SHELL_SANITIZE], [## --------------------- ## ## M4sh Initialization. ## @@ -627,6 +628,8 @@ echo $ECHO_N "_AS_QUOTE([$1])$ECHO_C" >& # AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD]) # ---------------------------------------- +# Output STRING to file descriptor FD; also log the string if +# AS_MESSAGE_LOG_FD is defined. m4_define([AS_MESSAGE], [m4_ifset([AS_MESSAGE_LOG_FD], [{ _AS_ECHO_LOG([$1]) @@ -637,12 +640,14 @@ _AS_ECHO([$as_me: $1], [$2]);}], # AS_WARN(PROBLEM) # ---------------- +# Issue the warning message PROBLEM. m4_define([AS_WARN], [AS_MESSAGE([WARNING: $1], [2])])# AS_WARN # AS_ERROR(ERROR, [EXIT-STATUS = 1]) # ---------------------------------- +# Issue the error message ERROR, then exit the script with EXIT-STATUS. m4_define([AS_ERROR], [{ AS_MESSAGE([error: $1], [2]) AS_EXIT([$2]); }[]dnl @@ -750,6 +755,7 @@ AS_DIRNAME_SED([$1])]) # _AS_DIRNAME_PREPARE # -------------------- +# Not all platforms have dirname. m4_defun([_AS_DIRNAME_PREPARE], [if (dirname /) >/dev/null 2>&1; then as_dirname=dirname @@ -888,7 +894,8 @@ $as_ln_s $1 $2 # AS_MKDIR_P(DIR) # --------------- -# Emulate `mkdir -p' with plain `mkdir'. +# Emulate `mkdir -p' with plain `mkdir'. Exit the script if DIR cannot be +# created. m4_define([AS_MKDIR_P], [AS_REQUIRE([_$0_PREPARE])dnl { if $as_mkdir_p; then @@ -907,6 +914,7 @@ m4_define([AS_MKDIR_P], # _AS_MKDIR_P_PREPARE # ------------------- +# Determine whether mkdir supports -p. m4_defun([_AS_MKDIR_P_PREPARE], [if mkdir -p . 2>/dev/null; then as_mkdir_p=: @@ -1024,6 +1032,7 @@ m4_define([AS_BOX], # _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `-']) # ------------------------------------------------- +# AS_BOX for literal strings. m4_define([_AS_BOX_LITERAL], [cat <<\_ASBOX m4_text_box($@) @@ -1032,6 +1041,7 @@ _ASBOX]) # _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `-']) # ----------------------------------------------- +# AS_BOX for shell indirections. m4_define([_AS_BOX_INDIR], [sed 'h;s/./m4_default([$2], [-])/g;s/^.../@%:@@%:@ /;s/...$/ @%:@@%:@/;p;x;p;x' <<_ASBOX @%:@@%:@ $1 @%:@@%:@ @@ -1271,6 +1281,7 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits # _AS_TR_SH_PREPARE # ----------------- +# Output variable for common tr usage. m4_defun([_AS_TR_SH_PREPARE], [AS_REQUIRE([_AS_CR_PREPARE])dnl # Sed expression to map a string onto a valid variable name. @@ -1293,6 +1304,7 @@ AS_LITERAL_IF([$1], # _AS_TR_CPP_PREPARE # ------------------ +# Output variable for common tr usage. m4_defun([_AS_TR_CPP_PREPARE], [AS_REQUIRE([_AS_CR_PREPARE])dnl # Sed expression to map a string onto a valid CPP name. @@ -1317,6 +1329,7 @@ AS_LITERAL_IF([$1], # _AS_TR_PREPARE # -------------- +# Output variables for common tr usage. m4_defun([_AS_TR_PREPARE], [AS_REQUIRE([_AS_TR_SH_PREPARE])dnl AS_REQUIRE([_AS_TR_CPP_PREPARE])dnl