[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: uninitialized variables
From: |
Ralf Wildenhues |
Subject: |
Re: uninitialized variables |
Date: |
Mon, 7 Nov 2005 21:32:06 +0100 |
User-agent: |
Mutt/1.5.9i |
Hi Paul,
* Paul Eggert wrote on Mon, Nov 07, 2005 at 03:07:10AM CET:
> Ralf Wildenhues <address@hidden> writes:
>
> > + tmp=
> > trap 'exit_status=$?; rm -fr "$tmp" && exit $exit_status' 0
>
> On ancient systems, "" is an alias for ".",
Should this be mentioned in autoconf.texi? Do you know offhand of such
a system? I'm trying to evaluate whether I need to audit Libtool for
this.
> so can you please change
> the code to check whether tmp is empty? Also, we should check that
> $tmp is a directory, for the same reason that AS_TMPDIR does.
> Something like this, perhaps?
>
> trap '
> exit_status=$?
> { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit
> $exit_status
> ' 0
>
> This code still has a race condition, as tmpdir might not get cleaned
> up if the script is interrupted between the time the directory is made
> and $tmp is assigned to. Perhaps that could be in a comment somewhere.
How about this?
* lib/autoconf/status.m4 (_AC_OUTPUT_MAIN_LOOP): Initialize
`tmp' to avoid file removal race.
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.77
diff -u -r1.77 status.m4
--- lib/autoconf/status.m4 21 Oct 2005 07:36:32 -0000 1.77
+++ lib/autoconf/status.m4 7 Nov 2005 06:46:44 -0000
@@ -1317,9 +1322,14 @@
# simply because there is no reason against having it here, and in addition,
# creating and moving files from /tmp can sometimes cause problems.
# Hook for its removal unless debugging.
+# 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'.
$debug ||
{
- trap 'exit_status=$?; rm -fr "$tmp" && exit $exit_status' 0
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
trap 'AS_EXIT([1])' 1 2 13 15
}
dnl The comment above AS_TMPDIR says at most 4 chars are allowed.
> > * lib/autoconf/general.m4 (_AC_INIT_DEFAULTS): Initialize
> > ac_clean_files and LIBOBJS.
>
> That looks good to me; please install.
Done. Thanks for the review.
Cheers,
Ralf