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.

> 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.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to