[tor-bugs] #4414 [Thandy]: ScriptWrapper should be multiplatform

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Fri Nov 11 15:43:54 UTC 2011


#4414: ScriptWrapper should be multiplatform
--------------------+-------------------------------------------------------
 Reporter:  chiiph  |          Owner:  nickm       
     Type:  defect  |         Status:  needs_review
 Priority:  normal  |      Milestone:              
Component:  Thandy  |        Version:              
 Keywords:          |         Parent:              
   Points:          |   Actualpoints:              
--------------------+-------------------------------------------------------

Comment(by nickm):

 You're still not handling \ correctly, or nul, or any number of characters
 not legal for literal use.  If I stick \" in the middle of a string, your
 code will turn it into \\", breaking out of the string as before.

 I don't think this is even necessary.  Because this is happening in the
 same python process, this should have the same os module.  So you can just
 do
 {{{
    old_environ = os.environ.copy()
    os.environ.clear()
    os.environ.update(self._env)
    try:
       # do the exec stuff here
    finally:
       os.environ.clear()
       os.environ.update(old_environ)
 }}}

 Also, this code does a bare "except:"  ... so if there is an error, there
 is no way to find out what the error was.  For debugging, that seems like
 a problem.

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/4414#comment:12>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list