| Bug #65509 | "strfill" function missing from ODBC Connector | ||
|---|---|---|---|
| Submitted: | 4 Jun 2012 12:46 | Modified: | 7 Jun 2012 14:09 |
| Reporter: | Chris Curvey | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | Connector / ODBC | Severity: | S1 (Critical) |
| Version: | 5.1.11 | OS: | Linux (Ubuntu 12.04) |
| Assigned to: | Bogdan Degtyariov | CPU Architecture: | Any |
[7 Jun 2012 11:57]
Bogdan Degtyariov
Chris, strfill is one of the functions exported by MySQL Client library among many others used in Connector/ODBC. By default the ODBC driver is linked against libmysqlclient_r.a static library, so all used client functions bodies are embedded into the driver file. Getting such error only possible if you built the driver yourself and linked it to the shared version of libmysqlclient_r.so. If the path to it is not in $LD_LIBRARY_PATH you can have all sorts of errors. You can check this by using the following command: ldd libmyodbc5.so | grep libmysqlclient So, the solution is re-linking the driver once again. Before doing so you should remove libmysqlclient*.so files in MySQL lib directory.
[7 Jun 2012 12:40]
Chris Curvey
No luck. I didn't build the driver myself (at least, I don't think I did), I just pulled the source to find that missing function.
I don't seem to have a libmyodbc5.so, but I do have a libmyodbc.so. (And my program complains about it missing if ldd reports:
chris@mu:/usr/lib/x86_64-linux-gnu/odbc$ !ldd
ldd libmyodbc.so | grep libmysqlclient
libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007fe71886c000)
[7 Jun 2012 13:19]
Bogdan Degtyariov
Chris, ldd reports that it does require libmysqlclient.so.18, which is not supposed to be with any of our released binaries. Not everyone wants to install client programs, so the driver should be as much independent as possible. Also, the library name libmyodbc.so instead of libmyodbc5.so does not look as something from the officially released distributions. Which package did you use to install it? Was that mysql-connector-odbc-5.1.11-linux-glibc2.3-x86-32bit.tar.gz ? Or you have got it as Ubuntu package?
[7 Jun 2012 13:46]
Chris Curvey
Thanks again. I'm learning a lot. Could this be a problem with the packaging in the Ubuntu or Debian world, and not an issue with the MySQL packages? Searching for issues related to this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=661422 (although I don't really understand what happened there) I suppose I will report this to Ubuntu and let them tell me if I should kick it upstream to Debian.
[7 Jun 2012 14:09]
Bogdan Degtyariov
Chris, This is obviously the packaging/building problem in Ubuntu. MySQL driver is not supposed to load mysql client shared library at all. Only the static linking can make sure the ODBC driver works properly because it depends on the particular implementations of client functions and header declarations. The bug reference you gave just says about the possibility of using MySQL 5.5 client library for MySQL ODBC driver 5.1. Surely, that whole problem occurred because the driver binary depended on libmysqlclient.so. I am setting "Not a bug" status to this report.

Description: when using the MyODBC connector via Python, I'm getting a core dump and the following message: /usr/bin/python: symbol lookup error: /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so: undefined symbol: strfill And sure enough, if I look in the source, there is a reference to a strfill() function. chris@mu:~/Downloads/mysql-connector-odbc-5.1.11-src$ find . -name "*.c" | xargs grep -n strfill ./driver/utility.c:1978: strfill(buff + length, DATETIME_DIGITS - length, '0'); ./driver/utility.c:3553: strfill(buff, sizeof(buff)-1, '0'); which does not appear anywhere else in the MyODBC source code. It also does not appear to be a standard library function (no man page). (note -- I'm intentionally not using the MySQL connector for Python.) How to repeat: I'm not quite sure when this is getting hit. I have a feeling it has to do with dates vs datetimes. Suggested fix: I did a quick search for stfill, and found several versions of it that appear to have been written by Monty and included in prior versions of the library. Perhaps simply including the function in the utility.c? One version of the code is listed here: /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* File : strfill.c Author : Monty Updated: 1987.04.16 Defines: strfill() strfill(dest, len, fill) makes a string of fill-characters. The result string is of length == len. The des+len character is allways set to NULL. strfill() returns pointer to dest+len; */ #include <my_global.h> #include "m_string.h" my_string strfill(my_string s,uint len,pchar fill) { while (len--) *s++ = fill; *(s) = '\0'; return(s); } /* strfill */