[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] config.status: minimize use of $tmp
From: |
Eric Blake |
Subject: |
Re: [PATCH 2/2] config.status: minimize use of $tmp |
Date: |
Mon, 30 Aug 2010 10:41:47 -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 01:24 PM, Eric Blake wrote:
I like the fact that I can use ${ac_tmp:=$tmp} ;)
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; }&& exit $exit_status
+ { test ! -d "${ac_tmp:=$tmp}" || rm -fr "$ac_tmp"; }&& exit $exit_status
And then I promptly used it incorrectly. Per what we just documented,
we cannot assume that ${a=b} takes effect in the parent shell if we are
executing a child command like test, so the rm -fr "$ac_tmp" command
would be suspect in some, but not all, shells (although I don't know
that I could reliably reproduce the race conditions necessary to expose
that bug). So I'm squashing this in, by inspection:
diff --git i/lib/autoconf/status.m4 w/lib/autoconf/status.m4
index c44aed4..07889ae 100644
--- i/lib/autoconf/status.m4
+++ w/lib/autoconf/status.m4
@@ -1626,13 +1626,14 @@ fi
# Note that there is a small window in which the directory will not be
cleaned:
# after its creation but before its name has been assigned to `$tmp'.
dnl For historical reasons, AS_TMPDIR must continue to place the results
-dnl in $tmp; but we swap to the namespace clean $ac_tmp to avoid issues
+dnl in $tmp; but we swap to the namespace-clean $ac_tmp to avoid issues
dnl with any CONFIG_COMMANDS playing with the common variable name $tmp.
$debug ||
{
tmp= ac_tmp=
trap 'exit_status=$?
- { test ! -d "${ac_tmp:=$tmp}" || rm -fr "$ac_tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'AS_EXIT([1])' 1 2 13 15
}
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
- [PATCH] docs: mention another issue with variable expansion, Eric Blake, 2010/08/26
- [PATCHv2] docs: mention another issue with variable expansion, Eric Blake, 2010/08/26
- Re: [PATCHv2] docs: mention another issue with variable expansion, Ralf Wildenhues, 2010/08/27
- Re: [PATCHv2] docs: mention another issue with variable expansion, Eric Blake, 2010/08/27
- [PATCH 0/2] cleanup $tmp usage, Eric Blake, 2010/08/27
- Re: [PATCH 0/2] cleanup $tmp usage, Ralf Wildenhues, 2010/08/27
- Re: [PATCH 0/2] cleanup $tmp usage, Eric Blake, 2010/08/30
- Re: [PATCH 0/2] cleanup $tmp usage, Ralf Wildenhues, 2010/08/30
- Re: [PATCH 0/2] cleanup $tmp usage, Eric Blake, 2010/08/30
- [PATCH 2/2] config.status: minimize use of $tmp, Eric Blake, 2010/08/27
- Re: [PATCH 2/2] config.status: minimize use of $tmp,
Eric Blake <=
- Re: [PATCH 2/2] config.status: minimize use of $tmp, Ralf Wildenhues, 2010/08/30
- Re: [PATCH 2/2] config.status: minimize use of $tmp, Eric Blake, 2010/08/30
- Re: [PATCH 2/2] config.status: minimize use of $tmp, Paul Eggert, 2010/08/30
- [PATCH 1/2] docs: avoid use of $tmp outside of config.status use, Eric Blake, 2010/08/27