[tor-bugs] #12088 [Pluggable transport]: goptlib should provide a method for querying the state location.

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun May 25 17:50:27 UTC 2014


#12088: goptlib should provide a method for querying the state location.
-------------------------------------+------------------------------
     Reporter:  yawning              |      Owner:  dcf
         Type:  enhancement          |     Status:  needs_review
     Priority:  normal               |  Milestone:
    Component:  Pluggable transport  |    Version:
   Resolution:                       |   Keywords:  goptlib, library
Actual Points:                       |  Parent ID:
       Points:                       |
-------------------------------------+------------------------------

Comment (by dcf):

 Replying to [comment:3 yawning]:
 > Replying to [comment:2 dcf]:
 > > I don't know what's the best way to deal with errors from os.MkdirAll.
 The patch in comment:1 crafts a new ENV-ERROR, which is reasonable, even
 though failure to create a directory is not really an environment error.
 It is a bit awkward that the function above will print an error to stdout
 in one case, but not in the other. On the other hand, it doesn't matter so
 much, because any error is likely to be a fatal error; i.e.
 > > {{{
 > > stateDir, err := pt.MakeStateDir()
 > > if err != nil {
 > >     log.Fatalf("failed to create state directory: %s", err)
 > > }
 > > }}}
 > > After all, there are many other errors that can happen during the
 execution of a transport (like the ORPort unexpectedly closing), and
 there's currently no way to report generic errors back up to tor other
 than simply terminating. Failure to create a directory could be considered
 one of these generic errors.
 >
 > PT error reporting is a bit of a mess.  Another problem with the
 proposed API given our current error handling limitations is that if the
 pt implementation defers calling `pt.MakeStateDir()` till after it sends
 the appropriate `DONE` line back over stdout that the error feedback won't
 get passed to the user at all beyond "yet another frustrating case of 'pt
 randomly died at startup'".  I know wfn had a patch to redirect stderr to
 the tor log which probably solves this in the long run, so perhaps it is
 reasonable to defer till then.

 About error reporting: suppose your transport needs to create its own
 subdirectories in the state dir. You call pt.MakeStateDir, then you
 manually create the directories inside it. Suppose the creation of one of
 these directories fails. Is that an ENV-ERROR? If not, then a failure to
 create the state dir itself probably should also not be an ENV-ERROR.
 (Except to the extent that we abuse ENV-ERROR as a general-purpose error
 logging function.)

 CMETHOD-ERROR/SMETHOD-ERROR could be a good way to report these kinds of
 generic errors that happen at startup. "CMETHOD-ERROR foo failed to create
 state directory." The only thing is I bet application authors want to
 handle all the state dir stuff once at the top of their program, before
 they enter the CMETHOD processing loop. It kind of makes me wish for a
 GENERIC-ERROR that could appear at any time during negotiation.

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


More information about the tor-bugs mailing list