Nick Kew wrote:
> That 0x0 looks like dbname. What happens if you pass
> it a dbname in the params string?
Sharp eyes, but no joy. The mysql docs say mysql_real_connect() is safe to call
with db==NULL. But just in case, I checked it...
---
Program received signal SIGSEGV, Segmentation fault.
0x2811c9fe in my_stat (
path=0xbfbfd1b0 "/usr/local/share/mysql/charsets/Index.xml",
stat_area=0xbfbfd110, my_flags=0) at my_lib.c:650
650 my_errno= errno;
(gdb) bt
#0 0x2811c9fe in my_stat (
path=0xbfbfd1b0 "/usr/local/share/mysql/charsets/Index.xml",
stat_area=0xbfbfd110, my_flags=0) at my_lib.c:650
#1 0x28113868 in my_read_charset_file (
filename=0xbfbfd1b0 "/usr/local/share/mysql/charsets/Index.xml", myflags=0)
at charset.c:318
#2 0x28113c6c in init_available_charsets (myflags=0) at charset.c:422
#3 0x28114149 in get_charset_by_csname (cs_name=0x8186180 "latin1",
cs_flags=2, flags=16) at charset.c:558
#4 0x281283ee in mysql_init_character_set (mysql=0x8136800) at client.c:1704
#5 0x28129c8c in mysql_real_connect (mysql=0x8136800,
host=0x814e190 "bfoz.net", user=0x814e1a0 "logger", passwd=0x28135e38 "",
db=0x814e1a8 "httpd_log", port=3306, unix_socket=0x0, client_flag=0)
at client.c:2093
#6 0x280ed86c in dbd_mysql_open (pool=0x80b9018,
params=0x80eb64c "host=bfoz.net,user=logger,dbname=httpd_log")
at
/usr/tmp/usr/ports/www/apache22/work/httpd-2.2.3/srclib/apr-util/dbd/apr_dbd_mysql.c:728
#7 0x280ebc3c in apr_dbd_open (driver=0x280ef800, pool=0x80b9018,
params=0x80eb64c "host=bfoz.net,user=logger,dbname=httpd_log",
handle=0x8175b9c)
at
/usr/tmp/usr/ports/www/apache22/work/httpd-2.2.3/srclib/apr-util/dbd/apr_dbd.c:163
<snip>
---
On the plus side, you led me to find a bug that was preventing dbname from
being passed in the param string. :)
> Do you have anything else that links to MySQL in your apache?
Not that I know of. It's a default install with all the other dbd-related
modules commented out.
For kicks I tried running mysql under gdb with a breakpoint on my_stat() and
saw the following output. It seems that my_stat() has moved to a different line
in my_lib.c. That seems odd to me.
---
Breakpoint 2, my_stat (path=0xbfbfe420 "/etc/my.cnf", stat_area=0xbfbfe425,
my_flags=0) at my_lib.c:639
639 DBUG_ENTER("my_stat");
---
A few more breakpoints later and we get something more familiar...
---
Breakpoint 2, my_stat (
path=0xbfbfd650 "/usr/local/share/mysql/charsets/Index.xml",
stat_area=0x0, my_flags=0) at my_lib.c:639
639 DBUG_ENTER("my_stat");
---
But for some reason it doesn't segfault this time.