Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.3.7
-
None
-
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.