I have a problem with the sonar build-wrapper for one of my projects.
There is an uncaught exception in the build-wrapper itself.
At first I thought the build wrapper was making the test crash somehow but then I realised it was the build-wrapper itself that was crashing.
I’m not sure if this is the right place to report this.
I am also wondering where the source code for the build wrapper is.
I cannot identify which project it is (assuming it is somewhere in SonarSource · GitHub)
It happens when it tries to analyse a couple of tests which use va_arg.
If I disable those tests the wrapper does not fail.
Given enough time I could probably create a smaller test program which reproduces it.
I might be able to create a patch myself if I can locate the build-wrapper source.
The bit of our code that seems to sometimes trigger it is:
void Posix::appendArgv(
std::vector< char * > &argv,
va_list *ap
)
{
char *arg = 0;
do
{
arg = va_arg(*ap, char *);
argv.push_back(arg);
}
while (arg != 0);
}
>./target/sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --version
build-wrapper, version 6.30 (linux-x86)
Copyright (C) 2014-2021 SonarSource SA, [info@sonarsource.com](mailto:info@sonarsource.com)
>./target/sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir target/bw-output ./cppunit-testsuite
.................................................................................arg: terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
OK (81 tests)
Aborted (core dumped)
#0 0x00007fec6793937f in raise () from /usr/lib64/libc.so.6
#1 0x00007fec67923db5 in abort () from /usr/lib64/libc.so.6
#2 0x0000564a629f708e in __gnu_cxx::__verbose_terminate_handler() [clone .cold] ()
#3 0x0000564a62a05c5c in __cxxabiv1::__terminate(void (*)()) ()
#4 0x0000564a62a05cc7 in std::terminate() ()
#5 0x0000564a62a05e29 in __cxa_throw ()
#6 0x0000564a629f850b in std::__throw_logic_error(char const*) ()
#7 0x0000564a629febec in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) ()
#8 0x0000564a629feaec in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*>(char const*, char const*, std::__false_type) ()
#9 0x0000564a629fe983 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*) ()
#10 0x0000564a629fe565 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&) ()
#11 0x0000564a629fb73a in bwrapper::handleCapture(std::basic_ofstream<char, std::char_traits<char> >&, Capture&) ()
#12 0x0000564a629fbce7 in bwrapper::collectCaptures(int) ()
#13 0x0000564a629fdac0 in bwrapper::work(int, char* const*, char* const*) ()
#14 0x0000564a629f9c95 in main ()