On 05/06/2014 07:17 AM, Peter Maydell wrote: > When libtool support was added to configure, the new temporary files > were left out of the list of files cleaned up on exit; this results > in a lot of stale .lo files being left around in /tmp. Worse, libtool > creates a /tmp/.libs directory which we can't easily clean up. > > Put all our temporary files in a single temporary directory created > via mktemp -d, so we can easily clean it up. This has the bonus > result that we no longer use $RANDOM (which silently expands to the > empty string if your shell is not bash, and so is pretty useless). > > Note that because we now use mktemp's tempdir-finding logic rather > than handrolling it, we no longer honour TEMPDIR (only TMPDIR). > > Signed-off-by: Peter Maydell <[email protected]> > --- > I don't know why we were looking at TEMPDIR; that code was > in there from the initial commit by Fabrice back in 2003... >
> + > +TMPDIR1=$(mktemp -t -d) mktemp is not POSIX. BSD mktemp lacks -t: http://www.freebsd.org/cgi/man.cgi?query=mktemp&apropos=0&sektion=1&manpath=Red+Hat+Linux%2Fi386+9&format=html and there are probably systems that lack mktemp(1) altogether. You'll need to come up with a more portable alternative. Here's what autoconf recommends (modify to fit...): # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp The use of $$ and $RANDOM is safe (even on shells that lack $RANDOM) because of the fact that mkdir is atomic and the umask is correctly set prior to the mkdir. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
