[tor-bugs] #13125 [Tor]: Review the guardiness python script of #9321

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 25 02:24:33 UTC 2014


#13125: Review the guardiness python script of #9321
------------------------+--------------------------------
     Reporter:  asn     |      Owner:
         Type:  defect  |     Status:  needs_review
     Priority:  normal  |  Milestone:  Tor: 0.2.7.x-final
    Component:  Tor     |    Version:
   Resolution:          |   Keywords:  tor-guard tor-auth
Actual Points:          |  Parent ID:  #9321
       Points:          |
------------------------+--------------------------------

Comment (by NickHopper):

 === consensus.py: ===
 line 17: Are we sure all dirauths will run the parser at the same time
 offset? If some dirauths run just before the hour and some just after the
 hour there could be off-by-one differences even if the dirauths all have
 essentially the same view of the history.

 line 34: probably best to use stem.Flag.GUARD instead of 'Guard'

 line 56: I think your schema should do this, since you require the
 consensus dates to be unique

 === guards_ds.py ===
 write_output_file:
 I think what you're trying to do here, by appending everything to f_str
 before writing is like an atomic write?  But I think file.write() could
 still fail, and in the meantime you've truncated the output file by
 opening it w+.  If you want to do an atomic replacement, you need to do a
 two-phase commit, e.g. write to a tempfile and then rename it after the
 write is complete.

 === guard_fraction.py: ===
 lines 92-94: same comment as consensus.py; it would seem prudent to round
 to the nearest hour so that we don't get off-by-one errors with different
 dirauths having a database that is off by one consensus.

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


More information about the tor-bugs mailing list