[tor-bugs] #4647 [Tor]: Tor needs to parse its command line exactly once

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 5 02:06:30 UTC 2013


#4647: Tor needs to parse its command line exactly once
-------------------------+--------------------------------
     Reporter:  rransom  |      Owner:
         Type:  defect   |     Status:  needs_review
     Priority:  major    |  Milestone:  Tor: 0.2.5.x-final
    Component:  Tor      |    Version:
   Resolution:           |   Keywords:  tor-client
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+--------------------------------

Comment (by nickm):

 Replying to [comment:16 nickm]:
 > I asked ctoader to have a look, and he said:
 >
 > >I told you I'd email back about #4647, I went through it again with the
 debugger and it looks good as it is. I wrote just a few notes on how I
 think things would be more robust.
 > >
 > >The only drawback is that you cannot recover from a bad command such as
 "asdasd" which is treated as a command which also takes an argument so
 "asdad -f something.cfg" would pair the first 2 as key-value which would
 mess up the whole thing. Could be fixed, but most likely is not worth the
 effort, if config_parse_commandline() also validates each command, instead
 of having the commands validated in options_init_from_string(). This would
 also have to be done to options in conf files as well (in
 load_torrc_from_disk() maybe).

 Hm. I agree that error messages could be improved, but I don't think we're
 actually making matters worse with this patch.  Previously, we'd get
 really confused by "tor  asdad -f something.cfg", and happily read
 something.cfg, and then get confused by our inability to set "asdad -f",
 or something like that.  I'll add another ticket for that when I merge
 this.

 > >
 > >Also config_parse_commandline() can be called just once in tor_init()
 and have options_init_from_torrc() use the global_cmdline_options and
 cmdline_only_only set in tor_init(). In case SIGHUP is caught,
 options_init_from_torrc() doesn't need to re-parse the commandline, but it
 could if you check for argv == NULL.

 I agree that this patch doesn't deliver on the actual text of the summary
 ("parse command line exactly once"), but it does fine in effect ("parse
 command line in exactly one way".  I think that actually cacheing the
 result is probably needless.

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


More information about the tor-bugs mailing list