[Fwd: [Fwd: Re: Perl DBI DBD::mysql Problem]]
am 07.07.2002 06:24:22 von Ben DischingerHello,
It seems that MySql version 3.23.49, which ships with redhat 7.3, has a
bug in which when specifying the default mysql options file, causes a
seg fault.
How-To-Repeat:
Using the DBD::mysql perl library, this can be reproduced
with this code.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
#!/usr/bin/perl -w
use DBI;
my $dsn="DBI:mysql:gpengdb;";
$dsn .= ";mysql_read_default_file=/home/gpeng/.my.cnf";
my %attr = ( RaiseError => 0);
my $dbh = DBI->connect($dsn, undef, undef, \%attr);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~
Running strace on this produced:
....
open("/home/gpeng/.my.cnf", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0400, st_size=38, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
0) = 0x400c1000
read(3, "[client]\nuser=gpeng\npassword=New"..., 4096) = 38
read(3, "", 4096) = 0
close(3) = 0
munmap(0x400c1000, 4096) = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
After I installed a previous version of mysql, 3.23.41, everything
functions fine.
Thank you,
Ben Dischinger
--------------------------------------
Ge,
It seems as though the newest version of mysql has a bug in it in which
you cannot specify a default configuration file. I thought that the
problem was with the DBD::mysql module at first, but after doing a
strace and trying some different things I narrowed it down to the actual
mysql package. It seems very odd to me why it would work when it reads
the .my.cnf by default, but not when the file is specified within the
connect routines in DBI or C funtions.
I've installed the previous version of mysql, 3.23.41, and it seems to
work fine. I've only come across one other usenet message where someone
was having the same problem, and it appears to be isolated to Mysql 3.23.49.
Let me know if that works for you! Thanks for bringing it to my
attention. I will notify the mysql team of the bug.
Thanks!
Ben Dischinger
ge.peng@ndsu.nodak.edu wrote:
>Ben,
>
>It seems that the Perl module DBD::mysql have problem to read
>mysql_read_default_file. Could you please check it?
>
>The following script worked fine if without setting
>mysql_read_default_file but set the second and third arguments of DBI-
>
>>connect. However, if set mysql_read_default_file, It will pop out
>>
>message: Segmentation fault.
>For security reason, I need set mysql_read_default_file.
>
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
>#!/usr/bin/perl -w
>
>use DBI;
>
>my $dsn="DBI:mysql:gpengdb;";
>$dsn .= ";mysql_read_default_file=/home/gpeng/.my.cnf";
>my %attr = ( RaiseError => 0);
>my $dbh = DBI->connect($dsn, undef, undef, \%attr);
>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~
>
>Thanks,
>
>Ge
>
------------------------------------------------------------ ---------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail bugs-thread12164@lists.mysql.com
To unsubscribe, e-mail