[tor-bugs] #31305 [Core Tor/Fallback Scripts]: Add more useful logging to fallback scripts variable config

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 1 08:36:11 UTC 2019


#31305: Add more useful logging to fallback scripts variable config
---------------------------------------+------------------------------
 Reporter:  teor                       |          Owner:  teor
     Type:  defect                     |         Status:  needs_review
 Priority:  Medium                     |      Milestone:
Component:  Core Tor/Fallback Scripts  |        Version:
 Severity:  Normal                     |     Resolution:
 Keywords:  fallback, 043-should       |  Actual Points:  0.3
Parent ID:  #30971                     |         Points:  0.1
 Reviewer:  nickm                      |        Sponsor:
---------------------------------------+------------------------------
Changes (by teor):

 * status:  assigned => needs_review
 * reviewer:   => nickm
 * points:   => 0.1
 * actualpoints:   => 0.3


Comment:

 See my pull request:
 https://github.com/torproject/fallback-scripts/pull/7

 This fix was a bit more complicated than I expected, because python's
 default bool conversion accepts any string.

 This is the improved error output:

 int
 {{{
 $ TOR_FB_REASONABLY_LIVE_TIME="bad-int" ./updateFallbackDirs.py
 ERROR::Could not cast env var "TOR_FB_REASONABLY_LIVE_TIME" using function
 "<type 'int'>" and default "86400". ValueError: "invalid literal for int()
 with base 10: 'bad-int'"
 Exit 1
 }}}

 int, optional=True
 {{{
 $ TOR_FB_MAX_FALLBACK_COUNT=bad-int ./updateFallbackDirs.py
 ERROR::Could not cast optional env var value "bad-int" using function
 "<type 'int'>". ValueError: "invalid literal for int() with base 10: 'bad-
 int'"
 ERROR::Could not cast env var "TOR_FB_MAX_FALLBACK_COUNT" using function
 "<function opt_type_fn at 0x106ebab90>" and default "200". ValueError:
 "invalid literal for int() with base 10: 'bad-int'"
 Exit 1
 }}}

 bool
 {{{
 $ TOR_FB_PERFORM_IPV4_DIRPORT_CHECKS="bad-bool" ./updateFallbackDirs.py
 ERROR::Could not cast env var "TOR_FB_PERFORM_IPV4_DIRPORT_CHECKS" using
 function "<function custom_bool at 0x1014dab18>" and default "True".
 ValueError: "invalid literal for custom_bool(): 'bad-bool', default_val:
 'True', var_name: 'TOR_FB_PERFORM_IPV4_DIRPORT_CHECKS'"
 Exit 1
 }}}

 bool, optional
 I temporarily added a TOR_FB_TEST_BOOL_OPT variable for testing
 {{{
 $ TOR_FB_TEST_BOOL_OPT="bad-bool" ./updateFallbackDirs.py
 ERROR::Could not cast optional env var value "bad-bool" using function
 "<function custom_bool at 0x10257ab90>". ValueError: "invalid literal for
 custom_bool(): 'bad-bool', default_val: 'True', var_name:
 'TOR_FB_TEST_BOOL_OPT'"
 ERROR::Could not cast env var "TOR_FB_TEST_BOOL_OPT" using function
 "<function opt_type_fn at 0x10257ac08>" and default "True". ValueError:
 "invalid literal for custom_bool(): 'bad-bool', default_val: 'True',
 var_name: 'TOR_FB_TEST_BOOL_OPT'"
 Exit 1
 }}}

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


More information about the tor-bugs mailing list