[PATCH 1 of 1] util.system: Clear environment vars before deleting

Richard Lowe richlowe at richlowe.net
Sun Sep 20 15:37:08 CDT 2009


Mads Kiilerich <mads at kiilerich.com> writes:

> Danek Duvall wrote, On 09/20/2009 05:40 PM:
>> Mads Kiilerich wrote:
>>
>>    
>>>                   if prevgitdir is None:
>>> +                    os.environ['GIT_DIR'] = '' # del is noop on solaris
>>>                       del os.environ['GIT_DIR']
>>>                   else:
>>>                       os.environ['GIT_DIR'] = prevgitdir
>>>      
>> Wouldn't it be better, in general, to use the subprocess module directly,
>> and pass in the explicit environment?  I know that's a bit more work than
>> tweaking individual environment variables to suit the situation, but I
>> don't think that the latter is ever guaranteed to work (or, at least, the
>> situations where it doesn't always seem to be more than you'd expect).
>>    
>
> Yes, with Mercurial 1.3 where Python 2.4 is required we could rely on 
> subprocess instead.
>
> The change is simple, but I'm sure it will have some side effects on 
> some platforms. Let's try and see!
>
> (Danek: Perhaps you could convince some engineers with email adresses 
> similar to yours to come up with a patch for a working unsetenv and "del 
> os.environ[env]" in Python? That would give less bad PR ;-)

Which version of Solaris? on the latest bits, the python 2.6.1 that ship
with the OS, and a python 2.6.2 I just built both do work, as best as I
can see.

It looks like you built a copy that thinks Solaris doesn't have
unsetenv? (or on an older Solaris that really doesn't have it?)

-- Rich


More information about the Mercurial-devel mailing list