[tor-bugs] #30179 [Core Tor]: Building with 'ALL_BUGS_ARE_FATAL'

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Apr 14 14:31:11 UTC 2019


#30179: Building with 'ALL_BUGS_ARE_FATAL'
------------------------------+--------------------------
 Reporter:  gvanem            |          Owner:  (none)
     Type:  defect            |         Status:  new
 Priority:  Medium            |      Component:  Core Tor
  Version:  Tor: unspecified  |       Severity:  Normal
 Keywords:                    |  Actual Points:
Parent ID:                    |         Points:
 Reviewer:                    |        Sponsor:
------------------------------+--------------------------
 Building with **ALL_BUGS_ARE_FATAL** should AFAICS normally be
 reserved for Coverty and/or analysers. But just for kicks, I've
 added **-DALL_BUGS_ARE_FATAL** to my CFLAGS.

 This causes errors like these (from clang using a git-checkout from
 today):
 {{{
 buf/buffers.c(531,7):  error: too few arguments to function call, expected
 at least 5, have 4
   if (BUG(buf->datalen >= INT_MAX))
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ..\lib/log/util_bug.h(151,70):  note: expanded from macro 'BUG'
    (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
     ~~~~~~~~~~~~~~~~~~~~~                                            ^
 ..\lib/log/util_bug.h(242,1):  note: 'tor_assertion_failed_' declared here
 void tor_assertion_failed_(const char *fname, unsigned int line,
 ^
 buf/buffers.c(533,7):  error: too few arguments to function call, expected
 at least 5, have 4
   if (BUG(buf->datalen >= INT_MAX - string_len))
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ...
 }}}
 I've used this patch to fix it:
 {{{
 --- a/src/lib/log/util_bug.h 2019-04-14 03:56:41
 +++ b/src/lib/log/util_bug.h 2019-04-14 11:31:23
 @@ -148,7 +148,7 @@
  #define tor_assert_nonfatal_once(cond) tor_assert((cond))
  #define BUG(cond)                                                       \
    (ASSERT_PREDICT_UNLIKELY_(cond) ?                                     \
 -   (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")"), \
 +   (tor_assertion_failed_(SHORT_FILE__,__LINE__,__func__,"!("#cond")",
 NULL), \
      abort(), 1)                                                         \
     : 0)
  #elif defined(TOR_UNIT_TESTS) && defined(DISABLE_ASSERTS_IN_UNIT_TESTS)
 }}}


 W/o knowing what the correct fix would be.

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


More information about the tor-bugs mailing list