[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] init.sh: portability fix: use env's POSIX-specified -i optio
Re: [PATCH] init.sh: portability fix: use env's POSIX-specified -i option not -u
Tue, 06 Apr 2010 11:30:39 -0600
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:22.214.171.124) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4
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 <address@hidden>
> 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 address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
Description: OpenPGP digital signature