[PATCH RFC-STABLE] warn about harmful PYTHONPATH values (issue2557)

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Jul 28 11:08:38 CDT 2015



On 05/04/2012 09:33 AM, Matt Mackall wrote:
> On Fri, 2012-05-04 at 14:25 +0200, pierre-yves.david at logilab.fr wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at logilab.fr>
>> # Date 1336134161 -7200
>> # Branch stable
>> # Node ID 62db511c03ef5af6a421512e788a642bdacf5d24
>> # Parent  9450905de257e1ed09e1855ede0305567cf07b51
>> warn about harmful PYTHONPATH values (issue2557)
>>
>> The following values will add $PWD to `sys.path`::
>>
>>    PYTHONPATH='/foo/bar/:/jungle/babar:'
>>    PYTHONPATH=':/foo/bar/:/jungle/babar'
>>    PYTHONPATH='/foo/bar/::/jungle/babar'
>>    PYTHONPATH=''
>>
>> This changeset add a warning at mercurial startup about the issue::
>>
>>    WARNING: your PYTHONPATH end with ":"!
>>    WARNING: Python will add the current directory to import path.
>>    WARNING: Fix your PYTHONPATH to avoid potential erroneous import.
>
> Not excited about this. It's not really our job to make sure people
> don't do stupid things with their Python setup.
>
> Now that we add our own library path to the installed executable, we
> should probably instead be deleting any reference to PYTHONPATH from our
> docs so people aren't tempted to mess with it.

(Email necromancy). Would it make sense to issue a debug message with 
that. That would help people digging for debug data to call out 
suspicious situation.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list