Eric Blake wrote: > On 04/06/2010 11:26 AM, Jim Meyering wrote: >>> Even 'env -i' is risky, since you are removing other possibly-important >>> variables, like POSIXLY_CORRECT. Isn't it better to just do: >>> >>> d=`unset TMPDIR; mktemp -d ...` >>> >>> and bypass env altogether? >> >> Yes, that reminds me of your reporting that Cygwin >> doesn't deal with a cleared environment. Is that still the case? > > I just checked that 'env -i PATH="$PATH" mktemp' works on cygwin 1.5 and > 1.7, but mktemp is certainly a very simple program. The fact that you > kept $PATH was the redeeming factor in that case, but I can imagine that > more complex programs won't be so lucky.
Of course, using env -i like that can be problematic, in general, but the above is using it to run mktemp in one very specific case. Just to be clear: we're taking this slightly kludgey alternative solely to accommodate theoretical non-POSIX systems. Hmm... not sure I like that, but I've pushed the patch nonetheless. >> Here's the proposed patch: >> >>>From 584308368830f70c1b7b4b129d82457f7a9ca24f Mon Sep 17 00:00:00 2001 >> From: Jim Meyering <meyer...@redhat.com> >> Date: Tue, 6 Apr 2010 19:24:57 +0200 >> Subject: [PATCH] init.sh: simply unset TMPDIR rather than risking env -i >> >> * tests/init.sh (mktempd_): Using env -i is rather harsh, and >> although it probably works fine on all Unix-based systems, some >> systems (Cygwin?) cannot tolerate a totally cleared environment. >> Suggestion from Eric Blake. > > At any rate, I like this patch, whether or not Cygwin needed it.