Bug #52725 libmysqlclient visibility issues: exports list_* symbols among others
Submitted: 9 Apr 2010 15:55 Modified: 14 May 2010 11:48
Reporter: Nathan Brink Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.0.84-r1 OS:Linux (gentoo amd64)
Assigned to: CPU Architecture:Any
Tags: C API, liblist, libmysqlclient, visibility

[9 Apr 2010 15:55] Nathan Brink
Description:
I originally meant to file this bug here, but until today, visiting the http://bugs.mysql.com/report.php URL gave me some odd ``error verifying credentials'' error until I tried today.
https://bugs.gentoo.org/show_bug.cgi?id=312533

Examples of problems with exporting very general symbols are symbol collisions (with libraries such as liblist). These can make it impossible for a program to use both libmysqlclient and another library which owns the symbol ``namespace'' that mysqlclient is trying to use. (the list_ prefix would rightfully belong to liblist, for example).

How to repeat:
Write a program that uses both liblist ( http://ohnopub.net/liblist/ ) and libmysqlclient _and_ calls list_free(). The first problem will be a conflict between #include <list.h> and #include <mysql.h>. If the calls to liblist functions and mysql functions are placed in separate .c files to avoid the #include <> collision, the program successfully links but linking to libmysqlclient.so causes the program to link to mysql's version of list_free() rather than liblist's unless if the linker flags are passed in a specific order.

Suggested fix:
First, limit the number of symbols exported by libmysqlclient.so to those that belong to the public API. Secondly, for symbols meant to be publicly accessible or part of an internal API, make sure there is a prefix to each symbol that indicates the symbol belongs to libmysqlclient.so's ``namespace''. Backwards compatibility can be kept by adding #define-s to mysql.h or one of the files it includes.
[14 Apr 2010 11:48] MySQL Verification Team
Thank you for the bug report. Could you please provide a code sample test case. Thanks in advance.
[14 May 2010 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".