[MXS-2543] Compile error on Ubuntu 19.04 Created: 2019-06-05  Updated: 2019-06-18  Resolved: 2019-06-18

Status: Closed
Project: MariaDB MaxScale
Component/s: build
Affects Version/s: 2.3.7
Fix Version/s: 2.3.8

Type: Bug Priority: Major
Reporter: Vivian Kong Assignee: markus makela
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 19.04



 Description   

Hit the following compile error on Ubuntu 19.04 with gcc v8.3.0

/root/MaxScale/server/modules/routing/binlogrouter/blr_slave.cc: In function ‘int blr_handle_change_master(ROUTER_INSTANCE*, char*, char*)’:
/root/MaxScale/server/modules/routing/binlogrouter/blr_slave.cc:4345:47: error: ‘__builtin_snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(error, BINLOG_ERROR_MSG_LEN, "%s", message);
^~~~
In file included from /usr/include/stdio.h:867,
from /root/build/jansson/install/include/jansson.h:11,
from /root/MaxScale/maxutils/maxbase/include/maxbase/jansson.h:16,
from /root/MaxScale/maxutils/maxbase/include/maxbase/log.h:22,
from /root/MaxScale/include/maxscale/log.h:22,
from /root/MaxScale/include/maxscale/ccdefs.hh:27,
from /root/MaxScale/server/modules/routing/binlogrouter/blr.hh:23,
from /root/MaxScale/server/modules/routing/binlogrouter/blr_slave.cc:27:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin_snprintf’ output between 1 and 701 bytes into a destination of size 700
return _builtin_snprintf_chk (_s, __n, __USE_FORTIFY_LEVEL - 1,
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_bos (_s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/MaxScale/server/modules/routing/binlogrouter/blr_slave.cc:4345:47: error: ‘__builtin_snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(error, BINLOG_ERROR_MSG_LEN, "%s", message);
^~~~
In file included from /usr/include/stdio.h:867,
from /root/build/jansson/install/include/jansson.h:11,
from /root/MaxScale/maxutils/maxbase/include/maxbase/jansson.h:16,
from /root/MaxScale/maxutils/maxbase/include/maxbase/log.h:22,
from /root/MaxScale/include/maxscale/log.h:22,
from /root/MaxScale/include/maxscale/ccdefs.hh:27,
from /root/MaxScale/server/modules/routing/binlogrouter/blr.hh:23,
from /root/MaxScale/server/modules/routing/binlogrouter/blr_slave.cc:27:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:67:35: note: ‘__builtin_snprintf’ output between 1 and 701 bytes into a destination of size 700
return _builtin_snprintf_chk (_s, __n, __USE_FORTIFY_LEVEL - 1,
~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_bos (_s), __fmt, __va_arg_pack ());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [server/modules/routing/binlogrouter/CMakeFiles/binlogrouter.dir/build.make:135: server/modules/routing/binlogrouter/CMakeFiles/binlogrouter.dir/blr_slave.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2824: server/modules/routing/binlogrouter/CMakeFiles/binlogrouter.dir/all] Error 2
make: *** [Makefile:139: all] Error 2

I can get around it by adding `-Wno-format-truncation` to CMakeLists.txt.



 Comments   
Comment by markus makela [ 2019-06-18 ]

Doesn't seem to happen with the latest 2.3 sources. vivkong can you try to build again from the 2.3 branch?

Comment by Vivian Kong [ 2019-06-18 ]

I can't reproduce this on the 2.3 branch. Thanks Markus! Please close this.

Generated at Thu Feb 08 04:14:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.