Bug 1071685 - crash when linking libtspi and libmysqlclient
Summary: crash when linking libtspi and libmysqlclient
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: mariadb
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Honza Horak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-03-02 21:11 UTC by Nikos Mavrogiannopoulos
Modified: 2014-05-16 12:12 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-05-16 12:12:15 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1069079 0 unspecified CLOSED crash when linking libgnutls and libmysqlclient 2021-02-22 00:41:40 UTC

Internal Links: 1069079

Description Nikos Mavrogiannopoulos 2014-03-02 21:11:49 UTC
[This is a copy of #1069079 but I believe it should be reported here as well]

A trivial program that links against both libmysqlclient and libtspi will crash with a segfault.

Version-Release number of selected component (if applicable):
trousers-devel-0.3.11.2-3.el7
mariadb-devel-5.5.35-2.el7

How reproducible:
$ cat test.c
int main ()
{
  return 0;
}

$ gcc test.c -o test  -L/usr/lib64/mysql -lmysqlclient -ltspi 

$ ./test
Segmentation fault (core dumped)


Actual issue:
Adding printf() on the constructor and destructor reveals that when linking with both mysqlclient and tspi, only the destructor of tspi is called but not the constructor (and thus the crash).

It seems that the issue is in the name of the constructors/destructors. Both mysqlclient and tspi use the name "my_init", and the one responsible for calling them, is probably confused and doesn't call both.

A solution is to mark the constructors and destructors in both libraries as static.

Comment 1 Honza Horak 2014-03-06 15:49:22 UTC
Good catch and thanks for reporting. Now we need to figure out if other packages use my_init.

Comment 2 Honza Horak 2014-05-16 12:12:15 UTC
Since bug #1069079 is fixed, there is no problem in mariadb any more either. Closing.


Note You need to log in before you can comment on or make changes to this bug.