Bug #3074 Unversioned symbols in shared library
Submitted: 5 Mar 2004 5:18 Modified: 26 Jan 2006 3:04
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.18 OS:Linux (Debian GNU/Linux)
Assigned to: Sergey Vojtovich CPU Architecture:Any

[5 Mar 2004 5:18] Christian Hammers
Description:
Forwarded Debian bug report http://bugs.debian.org/236288 
submitted by Andreas Metzler <ametzler@debian.org>

> libmysqlclient10 and libmysqlclient12 do not use versioned symbols.
> If a program links at runtime against both versions of the library
> the resulting symbol clashes cause segmentation faults.
> 
> If you wonder how this can happen, I'll point to #235938: exim4 links
> against -12 and libpam. A user is using libpam-mysql for authentication
> with exim and at runtime both versions are linked to the binary,
> libmysqlclient12 and libmysqlclient10 is dlpened by PAM.

Could you comment on this issue?

thanks,

-christian-

How to repeat:
N/A

Suggested fix:
N/A
[6 Mar 2004 6:30] Sinisa Milivojevic
Of course.

We do not plan to version symbols.

As our manual strongly recommends, you should have one set of includes and one set of libraries for C API, never more then one.
[19 Sep 2005 19:16] Christian Hammers
Hello again

It's 1,5 years later and the problems are still the same. Adding versioned symbols would cost you nothing but a minor patch (provided) and even stay binary compatible with existing software! So please do it or at least discuss it with the ones who are maintaining the GNU autoconf/libtool part of MySQL.

Below you will find a longer explanation from Steve Langasek <vorlon@debian.org>, Debian Developer and attached the patch he mentioned. This patch will become part of
the Debian packages.

thanks,

-christian-

-------------Steve Langasek-------------------------------------------------------------------
Please find attached a patch which enables symbol versioning for
libmysqlclient14.  The same patch will probably apply pretty cleanly to
libmysqlclient12 as well, but I wanted to give you the libmysqlclient14
version first so that you could begin discussing it with upstream as
necessary.  Since most new software being compiled on Debian will be linked
against libmysqlclient14, it's important to get symbol versions officially
added as soon as possible so that people rebuilding packages will get the
benefit of them.

This is just like adding any new symbol to a library -- you can run old
software against a library that has added a new symbol, but if you have
software that uses the new symbol, it won't work against the old version of
the library.  For that reason, the patch enables symbol versioning
*unconditionally* on platforms that are known to support it, to ensure
compatibility across all distributions that are using this version of the
library.  The patch also probably warrants bumping SHARED_LIB_VERSION from
14:0:0 to 15:0:1 for the same reason (which is supposed to still give an
soname of libmysqlclient.so.14, AIUI).

I think that getting versioned symbols added to 14 and 15 should be the
first priority:  12 will mostly be an issue for transitions from sarge,
since most packages that get rebuilt will rebuild against 14; and we can't
add symbol versioning to the sarge package now, so adding them at all will
only help in the rare case that packages are re-uploaded and still building
against 12.  Just having 14 versioned will help take care of some segfaults,
though (statistically, half of them).

The symbol version that I chose, MYSQL_4.1, is arbitrary; if upstream would
prefer to use MYSQL_14, that's also a good choice.  Like package names, they
don't *have* to match the soname, but it's important that there be a 1:1
mapping with sonames; so basing the symbol version name on the SONAME is a
good way to ensure this.  Just make sure upstream uses a different one for
libmysqlclient15. :)
----------------------------------------------------------------------------------------
[19 Sep 2005 19:17] Christian Hammers
Patch for versioned symbols in libmysqlclient*.so

Attachment: mysql-dfsg-4.1-symbolversions.diff (text/plain), 2.52 KiB.

[16 Jan 2006 15:33] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/1148
[16 Jan 2006 21:11] Konstantin Osipov
Approved by email with a minor comment.
[17 Jan 2006 14:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/1200
[18 Jan 2006 19:49] Sergey Vojtovich
Fixed in 4.1.18, 5.0.19.
[26 Jan 2006 3:04] Mike Hillyer
Documented in 4.1.18, 5.0.19 changelogs:
<listitem>
        <para>
          <literal>libmysqlclient</literal> now uses versioned symbols.
          (Bug #3074)
        </para>
      </listitem>