[tor-bugs] #14881 [Core Tor/Tor]: incorrect defaults when producing bandwidth-weights line in directory footer

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Oct 28 13:55:28 UTC 2016


#14881: incorrect defaults when producing bandwidth-weights line in directory
footer
-------------------------------------------------+-------------------------
 Reporter:  robgjansen                           |          Owner:  pastly
     Type:  defect                               |         Status:
                                                 |  reopened
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.3.0.x-final
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.7
 Severity:  Normal                               |     Resolution:
 Keywords:  027-triaged-1-in, 028-triaged,       |  Actual Points:
  pre028-patch, tor-sponsorU-orphan,             |
  TorCoreTeam-postponed-201604, nickm-           |
  deferred-20161005, review-group-10             |
Parent ID:                                       |         Points:  3
 Reviewer:  mikeperry                            |        Sponsor:
                                                 |  SponsorU-can
-------------------------------------------------+-------------------------
Changes (by teor):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 On clang 3.9.0, i386, macOS Sierra, this patch causes the following
 warnings:

 {{{
 src/test/test_dir.c:2049:18: error: implicit conversion loses integer
 precision:
       'long long' to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val1_ = (a);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2049:29: error: implicit conversion loses integer
 precision:
       'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 ./src/ext/tinytest_macros.h:158:24: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:28: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:117:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val2_ = (b);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2064:18: error: implicit conversion loses integer
 precision:
       'long long' to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val1_ = (a);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2064:29: error: implicit conversion loses integer
 precision:
       'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 ./src/ext/tinytest_macros.h:158:24: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:28: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:117:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val2_ = (b);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2079:18: error: implicit conversion loses integer
 precision:
       'long long' to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val1_ = (a);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2079:29: error: implicit conversion loses integer
 precision:
       'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 ./src/ext/tinytest_macros.h:158:24: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:28: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:117:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val2_ = (b);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2094:18: error: implicit conversion loses integer
 precision:
       'long long' to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:158:22: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:26: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:116:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val1_ = (a);                                               \
              ~~~~~    ^
 src/test/test_dir.c:2094:29: error: implicit conversion loses integer
 precision:
       'int64_t' (aka 'long long') to 'long' [-Werror,-Wshorten-64-to-32]
   tt_int_op(G+M+E+D, OP_EQ, T);
   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 ./src/ext/tinytest_macros.h:158:24: note: expanded from macro 'tt_int_op'
         tt_assert_test_type(a,b,#a" "#op" "#b,long,(val1_ op val2_), \
         ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:144:28: note: expanded from macro
       'tt_assert_test_type'
         tt_assert_test_fmt_type(a,b,str_test,type,test,type,fmt,        \
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ./src/ext/tinytest_macros.h:117:16: note: expanded from macro
       'tt_assert_test_fmt_type'
         type val2_ = (b);
 }}}

 It looks like the unit tests need to consistently use int64_t, rather than
 assuming that long is always 64 bits.

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


More information about the tor-bugs mailing list