[tor-bugs] #9410 [Pluggable transport]: pyptlib.util.checkClientMode prints ENV-ERROR without raising EnvError

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Aug 7 19:31:03 UTC 2013


#9410: pyptlib.util.checkClientMode prints ENV-ERROR without raising EnvError
---------------------------------+------------------------------------------
 Reporter:  dcf                  |          Owner:  asn
     Type:  defect               |         Status:  new
 Priority:  minor                |      Milestone:     
Component:  Pluggable transport  |        Version:     
 Keywords:  pyptlib              |         Parent:     
   Points:                       |   Actualpoints:     
---------------------------------+------------------------------------------
 You get two ENV-ERROR lines on stdout when you use
 `pyptlib.util.checkClientMode` and `pyptlib.server.init` to try to
 implement a server-only transport, and no environment variables are set:

 {{{
 if pyptlib.util.checkClientMode():
     print >> sys.stderr, "This is only a server."
     sys.exit(1)
 try:
     info = pyptlib.server.init(["transport"])
 except pyptlib.config.EnvError, e:
     print >> sys.stderr, "pyptlib.server.init: %s" % e
     sys.exit(1)
 }}}

 The output of this is:

 {{{
 ENV-ERROR Missing environment variable TOR_PT_STATE_LOCATION
 ENV-ERROR Missing environment variable TOR_PT_STATE_LOCATION
 pyptlib.server.init: Missing environment variable TOR_PT_STATE_LOCATION
 }}}

 I guess if `checkClientMode` is going to be checking environment
 variables, I would like to catch `EnvError` when I call that function.

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


More information about the tor-bugs mailing list