[tor-bugs] #19999 [Core Tor/Tor]: Maybe test-cases should complete without BUG warnings?

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 29 09:55:05 UTC 2016


#19999: Maybe test-cases should complete without BUG warnings?
---------------------------------------+-----------------------------------
 Reporter:  nickm                      |          Owner:  nickm
     Type:  defect                     |         Status:  closed
 Priority:  High                       |      Milestone:  Tor:
                                       |  0.2.9.x-final
Component:  Core Tor/Tor               |        Version:
 Severity:  Normal                     |     Resolution:  fixed
 Keywords:  testing TorCoreTeam201609  |  Actual Points:  3
Parent ID:                             |         Points:  2
 Reviewer:                             |        Sponsor:
---------------------------------------+-----------------------------------

Comment (by rubiate):

 rend_cache/store_v2_desc_as_client will occasionally cough up a warning:

     [warn] rend_cache_store_v2_desc_as_client(): Bug: Couldn't decode
 base32 [scrubbed] for descriptor id. (on Tor 0.2.9.3-alpha-dev
 153ff4f559d9b7ee)

 The problem is on test_rendcache.c:158, it tries to test an incorrect ID
 by incrementing the first character of the base32 ID, which can make it
 invalid base32 depending on what the first character is. The test still
 passes because rend_cache_store_v2_desc_as_client() still fails, just for
 a different reason.

 Possible fix, go down if it can't go up:

 {{{
 diff --git a/src/test/test_rendcache.c b/src/test/test_rendcache.c
 index a5d3f35..baadf44 100644
 --- a/src/test/test_rendcache.c
 +++ b/src/test/test_rendcache.c
 @@ -87,7 +87,7 @@ test_rend_cache_lookup_entry(void *data)
  static void
  test_rend_cache_store_v2_desc_as_client(void *data)
  {
 -  int ret;
 +  int ret, mod;
    rend_data_t *mock_rend_query;
    char desc_id_base32[REND_DESC_ID_V2_LEN_BASE32 + 1];
    rend_cache_entry_t *entry = NULL;
 @@ -155,12 +155,19 @@ test_rend_cache_store_v2_desc_as_client(void *data)
    // Test incorrect descriptor ID
    rend_cache_init();
    mock_rend_query = mock_rend_data(service_id);
 -  desc_id_base32[0]++;
 +
 +  /* avoid incrementing beyond valid base32 characters */
 +  mod = (desc_id_base32[0] == 'z' ||
 +         desc_id_base32[0] == 'Z' ||
 +         desc_id_base32[0] == '7') ? -1 : 1;
 +
 +  desc_id_base32[0] += mod;
 +
    ret = rend_cache_store_v2_desc_as_client(desc_holder->desc_str,
                                             desc_id_base32,
 mock_rend_query,
                                             NULL);
    tt_int_op(ret, OP_EQ, -1);
 -  desc_id_base32[0]--;
 +  desc_id_base32[0] -= mod;
    rend_cache_free_all();

    // Test too old descriptor
 }}}

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


More information about the tor-bugs mailing list