Bug #15534 Shared compatibility libraries need Index and *.conf in charsets
Submitted: 6 Dec 2005 18:01 Modified: 9 Jul 2007 15:05
Reporter: Tony Mountifield Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version:4.1.16, 4.1.15 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[6 Dec 2005 18:01] Tony Mountifield
Description:
Having upgraded from 3.23.58 on Fedora to the 4.1.15 RPMs on the MySQL site, and using the compatibility shared libraries, I found that my legacy apps were crashing with a SEGV in my_fopen() called from mysql_real_connect().

I traced it to the fact that /usr/share/mysql/charsets no longer contained Index and *.conf file, but only Index.xml and *.xml files.

Regards
Tony Mountifield

How to repeat:
Compile a mysql client program on a 3.23 system and copy it to a 4.1.15 system with the compatibility libraries installed (libmysqlclient_r.so.10).

Suggested fix:
Copying Index and *.conf from a 3.23 system cured the crashing.

Please:
1. Include the older charset files in the newer package for compatibility purposes.
2. If my_fopen() can't find the file it wants (e.g. /usr/share/mysql/charsets/Index), please report an error instead of crashing!
[7 Dec 2005 9:22] Valeriy Kravchuk
Thank you for a problem report. There is a similar report already (http://bugs.mysql.com/bug.php?id=10818). Please, check is this really the same problem (and you can simply add comments and reopen that report) or it is totally different.
[7 Dec 2005 10:04] Tony Mountifield
This is a completely different bug to the one in 10818. This one is two deficiencies in the compatibility shared client libraries:

1. libmysqlclient_r.so.10 (and probably the non-re-entrant one too) expects to find the non-xml charset files, so they need to be included in the compatibility package.

2. When the my_fopen() function in that library fails to find the Index file, it crashes with a segv (probably trying to use a NULL file pointer without checking). Instead, it should be changed to return and/or display an error.
[20 Dec 2005 17:45] Valeriy Kravchuk
From what RMP had you installed that compatibility libraries? "Libraries and header files", "Dynamic client libraries"? 

As it may be a packaging bug, I need to know the exact package used. Please, check. You may also try to check the 4.1.16 packages from http://dev.mysql.com/downloads/mysql/4.1.html.
[20 Dec 2005 18:15] Tony Mountifield
The exact RPMs I installed are as follows:

MySQL-client-4.1.15-0.glibc23.i386.rpm
MySQL-devel-4.1.15-0.glibc23.i386.rpm
MySQL-server-4.1.15-0.glibc23.i386.rpm
MySQL-shared-compat-4.1.15-0.i386.rpm

The problem I am reporting is that the last of the RPMs listed above (shared-compat) needs to contain the following files and currently doesn't:

/usr/share/mysql/charsets/Index
/usr/share/mysql/charsets/cp1251.conf
/usr/share/mysql/charsets/cp1257.conf
/usr/share/mysql/charsets/croat.conf
/usr/share/mysql/charsets/danish.conf
/usr/share/mysql/charsets/dec8.conf
/usr/share/mysql/charsets/dos.conf
/usr/share/mysql/charsets/estonia.conf
/usr/share/mysql/charsets/german1.conf
/usr/share/mysql/charsets/greek.conf
/usr/share/mysql/charsets/hebrew.conf
/usr/share/mysql/charsets/hp8.conf
/usr/share/mysql/charsets/hungarian.conf
/usr/share/mysql/charsets/koi8_ru.conf
/usr/share/mysql/charsets/koi8_ukr.conf
/usr/share/mysql/charsets/latin1.conf
/usr/share/mysql/charsets/latin2.conf
/usr/share/mysql/charsets/latin5.conf
/usr/share/mysql/charsets/swe7.conf
/usr/share/mysql/charsets/usa7.conf
/usr/share/mysql/charsets/win1250.conf
/usr/share/mysql/charsets/win1251.conf
/usr/share/mysql/charsets/win1251ukr.conf

These files are needed to support the older shared libraries in the shared-compat package. The xml files are not sufficient.

I have no need to try the 4.1.16 packages, as I have solved the problem on my own systems. I just thought you might appreciate having the bug reported so that you can correct it in your packaging and thereby avoid future users encountering the same problem as I did.

So please check yourselves whether the above files are included in the 4.1.16 shared-compat RPM, and update the package to contain them if not.

I am very surprised that this bug report has been so difficult for you to understand. I have now tried to be as exhaustive as possible to avoid the need for you to ask any further questions.
[21 Dec 2005 10:57] Valeriy Kravchuk
Sorry for (stupid) questions. 

Yes, all that files:

/usr/share/mysql/charsets/Index
/usr/share/mysql/charsets/cp1251.conf
/usr/share/mysql/charsets/cp1257.conf
/usr/share/mysql/charsets/croat.conf
/usr/share/mysql/charsets/danish.conf
/usr/share/mysql/charsets/dec8.conf
/usr/share/mysql/charsets/dos.conf
/usr/share/mysql/charsets/estonia.conf
/usr/share/mysql/charsets/german1.conf
/usr/share/mysql/charsets/greek.conf
/usr/share/mysql/charsets/hebrew.conf
/usr/share/mysql/charsets/hp8.conf
/usr/share/mysql/charsets/hungarian.conf
/usr/share/mysql/charsets/koi8_ru.conf
/usr/share/mysql/charsets/koi8_ukr.conf
/usr/share/mysql/charsets/latin1.conf
/usr/share/mysql/charsets/latin2.conf
/usr/share/mysql/charsets/latin5.conf
/usr/share/mysql/charsets/swe7.conf
/usr/share/mysql/charsets/usa7.conf
/usr/share/mysql/charsets/win1250.conf
/usr/share/mysql/charsets/win1251.conf
/usr/share/mysql/charsets/win1251ukr.conf

are not included even in the latest 4.1.16 RPM:

[openxs@Fedora tmp]$ rpm -q -l -p MySQL-shared-compat-4.1.16-0.i386.rpm
/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.10
/usr/lib/libmysqlclient.so.10.0.0
/usr/lib/libmysqlclient.so.12
/usr/lib/libmysqlclient.so.12.0.0
/usr/lib/libmysqlclient.so.14
/usr/lib/libmysqlclient.so.14.0.0
/usr/lib/libmysqlclient_r.so
/usr/lib/libmysqlclient_r.so.10
/usr/lib/libmysqlclient_r.so.10.0.0
/usr/lib/libmysqlclient_r.so.12
/usr/lib/libmysqlclient_r.so.12.0.0
/usr/lib/libmysqlclient_r.so.14
/usr/lib/libmysqlclient_r.so.14.0.0

So, they should be included, or there should be some check in the package for these dependencies.

my_fopen() returns (FILE *)0 in case the file can not be opened. So, old sources for libmysqlclient.so.10 should be also checked for proper usage of my_fopen() and processing of cases when it returns 0.
[9 Jul 2007 15:05] Daniel Fischer
Mission impossible. Please upgrade and don't use versions of the library this old anymore.