[tor-bugs] #5557 [Tor Bridge]: Tor helpers' launch error message contains useless whitespace

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Wed May 9 00:47:11 UTC 2012


#5557: Tor helpers' launch error message contains useless whitespace
------------------------+---------------------------------------------------
 Reporter:  asn         |          Owner:                    
     Type:  defect      |         Status:  new               
 Priority:  normal      |      Milestone:  Tor: 0.2.3.x-final
Component:  Tor Bridge  |        Version:                    
 Keywords:              |         Parent:                    
   Points:              |   Actualpoints:                    
------------------------+---------------------------------------------------

Comment(by asn):

 I spent too many hours on this bug today. coding different fixes and
 realizing that they are all ugly.

 I ended up preferring these two:

 a) Refactor `format_helper_exit_status()` to create the string from left-
 to-right, instead of right-to-left. The problem here is the hex encode
 function, since an integer-to-hex-string (or an `itoa()`) function is kind
 of messy (it needs a `reverse()`). I was thinking that maybe a simpler
 solution would be better while in the signal-handler realm.

 b) Use `eat_whitespace()` to eat through the useless whitespace, and print
 the correct substring. This seems like the nicest solution, except from
 the fact that `eat_whitespace()` calls `tor_assert()` which is not signal-
 handler-safe. I'm thinking of making `eat_whitespace_impl()` with an extra
 boolean argument (say, `sig_safe`) which skips the `tor_assert()` if set.
 Then I can macro-ify `eat_whitespace_impl()` to `eat_whitespace()` and
 `eat_whitespace_signal_safe()`.

 Nick, any opinions or other ideas?

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


More information about the tor-bugs mailing list