autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/2] cleanup $tmp usage


From: Eric Blake
Subject: Re: [PATCH 0/2] cleanup $tmp usage
Date: Mon, 30 Aug 2010 10:32:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100806 Fedora/3.1.2-1.fc13 Mnenhy/0.8.3 Thunderbird/3.1.2

On 08/27/2010 03:43 PM, Ralf Wildenhues wrote:
* Eric Blake wrote on Fri, Aug 27, 2010 at 09:24:49PM CEST:
I wish you wouldn't use nor promote tmp as temporary variable name,
nor as a temporary macro name in tests/m4sh.at, given that it's already
documented as name of a temporary directory to use in config.status.

Good point.  I'm scrubbing that now...

Done.  I'll wait till Monday to push, though, in case you have further
comments.

Looks good to me, thanks!

Eric Blake (2):
   docs: avoid use of $tmp outside of config.status use
   config.status: minimize use of $tmp

As promised, here's the testsuite addition I'm adding to 2/2 before pushing. I verified that the testsuite addition without the status.m4 changes fails, but the patch as a whole succeeds.

diff --git c/tests/torture.at w/tests/torture.at
index 6855da4..e395fc1 100644
--- c/tests/torture.at
+++ w/tests/torture.at
@@ -29,6 +29,34 @@ AT_CHECK_MACRO([AC_CONFIG_COMMANDS with empty commands],
 ]])


+## --------------------------------------------- ##
+## AC_CONFIG_COMMANDS with temporary directory.  ##
+## --------------------------------------------- ##
+
+AT_CHECK_MACRO([AC_CONFIG_COMMANDS with temporary directory],
+[[AC_CONFIG_COMMANDS([foo], [
+case $ACTION in
+  use)
+    echo "$tmp" > tmpdir
+    test -d "$tmp" || AC_MSG_ERROR([No $tmp directory])
+    echo garbage-in > "$tmp/garbage-out"
+    ;;
+  corrupt)
+    echo "$tmp" > tmpdir
+    tmp=/nosuch
+    ;;
+  *) ;;
+esac
+])
+]], [
+AT_CHECK([test ! -f tmpdir])
+AT_CHECK([ACTION=use ./config.status], [], [ignore])
+AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
+AT_CHECK([ACTION=corrupt ./config.status], [], [ignore])
+AT_CHECK([test -s tmpdir && test ! -d "`cat tmpdir`"])
+])
+
+
 ## -------------------------- ##
 ## Multiple AC_CONFIG_FILES.  ##
 ## -------------------------- ##

--
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]