Bug 256497 - databases/mysql-connector-odbc: fix segmentaion fault in libmysql in mysql_get_character_set_info()
Summary: databases/mysql-connector-odbc: fix segmentaion fault in libmysql in mysql_ge...
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-09 09:14 UTC by titus m
Modified: 2021-06-09 10:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description titus m 2021-06-09 09:14:28 UTC
databases/mysql-connector-odbc causes segmentaion fault in libmysql in mysql_get_character_set_info()


#1  0x20eef454 in myodbc_do_connect(tagDBC*, DataSource*) () from /usr/local/lib/libmyodbc5a.so
#2  0x20eefb3c in MySQLConnect(void*, unsigned short*, short, unsigned short*, short, unsigned short*, short) ()
   from /usr/local/lib/libmyodbc5a.so
#3  0x20f0cf7c in SQLConnect () from /usr/local/lib/libmyodbc5a.so
#4  0x209e2830 in SQLConnect () from /usr/local/lib/libodbc.so.2
#5  0x20871020 in TclDatabase::TclDatabase(TclObj, TclObj, TclObj) () from ./libtclodbc2.5.so
#6  0x2087083c in tcl_database(void*, Tcl_Interp*, int, Tcl_Obj* const*) () from ./libtclodbc2.5.so
#7  0x20110618 in Tcl_EvalObjv () from /usr/local/lib/libtcl86.so.1
#8  0x20111c5c in ?? () from /usr/local/lib/libtcl86.so.1
#9  0x201cf48c in Tcl_FSEvalFileEx () from /usr/local/lib/libtcl86.so.1
#10 0x201d7b78 in Tcl_MainEx () from /usr/local/lib/libtcl86.so.1
#11 0x0002087c in ?? ()
#12 0x00020640 in ?? ()

i think the problem is caused by my_thread_global_init which is present in libmysqlient.so and libmyodbc5a and causing a split brain init 
odbc drv call mysql_init which calls mysql_server_init which calls my_thread_global_init and the odbc ver is executed and the static my_thread_global_init_done in lmysqlclient is not set
this cause silent failures of mysql_init and in the end segv

the fix is to link libmysqlclient(_r).a with the odbc driver
CMAKE_ARGS=     -DWITH_UNIXODBC=1 -DDISABLE_GUI=1 -DMYSQLCLIENT_STATIC_LINKING=1