maskit opened a new issue #7799:
URL: https://github.com/apache/trafficserver/issues/7799


   I realized a scary behavior change on compile. Code like below that has 
unmatched format specifiers used to cause compile errors, but we no longer see 
it on master because of some changes around Diag.
   
   ```diff
   diff --git a/proxy/http2/Http2ClientSession.cc 
b/proxy/http2/Http2ClientSession.cc
   index 434b4a3c4..4ada20fca 100644
   --- a/proxy/http2/Http2ClientSession.cc
   +++ b/proxy/http2/Http2ClientSession.cc
   @@ -208,7 +208,7 @@ Http2ClientSession::new_connection(NetVConnection 
*new_vc, MIOBuffer *iobuf, IOB
        Debug("ssl_early_data", "read_from_early_data = %" PRId64, 
this->read_from_early_data);
      }
    
   -  Http2SsnDebug("session born, netvc %p", this->_vc);
   +  Http2SsnDebug("session born, netvc %p %s", this->_vc);
    
      this->_vc->set_tcp_congestion_control(CLIENT_SIDE);
    
   
   ```
   
   On 9.1.x branch, the code above does not compile.
   ```
   Http2ClientSession.cc:211:42: error: more '%' conversions than data 
arguments [-Werror,-Wformat-insufficient-args]
     Http2SsnDebug("session born, netvc %p %s", this->_vc);
                                           ~^
   ```
   But on master, I don't see the compile error, and ATS crashes when I run it.
   ```
   * thread #5, name = '[ET_NET 3]', stop reason = EXC_BAD_ACCESS (code=1, 
address=0x41b58ab3)
     * frame #0: 0x0000000104604df0 
libclang_rt.asan_osx_dynamic.dylib`__sanitizer::internal_strlen(char const*) + 
16
       frame #1: 0x00000001045ca7c5 
libclang_rt.asan_osx_dynamic.dylib`printf_common(void*, char const*, 
__va_list_tag*) + 2069
       frame #2: 0x00000001045caa17 
libclang_rt.asan_osx_dynamic.dylib`wrap_vfprintf + 103
       frame #3: 0x00000001039f0372 
libtscore.10.dylib`Diags::print_va(this=0x0000612000000ac0, 
debug_tag="http2_cs", diags_level=DL_Debug, loc=0x000000010195ce80, 
format_string="[%lld] session born, netvc %p %s", ap=0x00000001092fe320) const 
at Diags.cc:273:7
   ```
   
   The change above is something I made up to demonstrate the error, but a real 
error on master is already hidden by the behavior change. I see this compile 
error below on 9.1.x but not on master.
   
   ```
   HttpSessionManager.cc:150:79: error: format specifies type 'long long' but 
the argument has type 'size_t' (aka 'unsigned long') [-Werror,-Wformat]
       Debug("http_ss", "Search for host name only not IP.  Pool size %" 
PRId64, m_fqdn_pool.count());
       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
   ../../include/tscore/Diags.h:330:39: note: expanded from macro 'Debug'
         diags->log(tag, DL_Debug, &loc, __VA_ARGS__);    \
                                         ^~~~~~~~~~~
   1 error generated.
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to