segfault errors on using numbers in execute statements
am 10.08.2006 22:39:12 von Sam SmithThe below fragment of code either segfaults or gives the
following error when run on OpenBSD 4.0-beta:
FREE ERROR BIND!FREE ERROR FBIND!
__START__
#!/usr/bin/perl
use warnings;
use strict;
use DBI;
my $dsn = 'DBI:mysql:glocaliser:localhost'; # DSN connection string
my $db_username= 'perl'; # database username
my $db_password= 'perl'; # database password
our $dbh= DBI->connect($dsn, $db_username, $db_password);
my $v= 8;
my $q= $dbh->prepare("select * from interests where tag=?")
$q->execute($v);
__END__
having the last line read $q->execute("$v") is a workaround.
A core of the more general case is:
(gdb) target core perl.core
Core was generated by `perl'.
Program terminated with signal 11, Segmentation fault.
bReading symbols from /usr/lib/libperl.so.10.1...tdone.
Loaded symbols for /usr/lib/libperl.so.10.1
Reading symbols from /usr/lib/libm.so.2.3...
done.
Loaded symbols for /usr/lib/libm.so.2.3
Reading symbols from /usr/lib/libutil.so.11.0...done.
Loaded symbols for /usr/lib/libutil.so.11.0
Reading symbols from /usr/lib/libc.so.39.2...done.
Loaded symbols for /usr/lib/libc.so.39.2
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
Reading symbols from /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBI/DBI .so...done.
Loaded symbols for /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBI/DBI .so
Reading symbols from /usr/libdata/perl5/i386-openbsd/5.8.8/auto/List/Util/Util.so ...done.
Loaded symbols for /usr/libdata/perl5/i386-openbsd/5.8.8/auto/List/Util/Util.so
Reading symbols from /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBD/mys ql/mysql.so...done.
Loaded symbols for /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBD/mys ql/mysql.so
Reading symbols from /usr/local/lib/mysql/libmysqlclient.so.16.0...done.
Loaded symbols for /usr/local/lib/mysql/libmysqlclient.so.16.0
Reading symbols from /usr/lib/libz.so.4.1...done.
Loaded symbols for /usr/lib/libz.so.4.1
Reading symbols from /usr/lib/libssl.so.10.0...done.
Loaded symbols for /usr/lib/libssl.so.10.0
Reading symbols from /usr/lib/libcrypto.so.12.1...done.
Loaded symbols for /usr/lib/libcrypto.so.12.1
Reading symbols from /usr/lib/libcrypto.so.13.0...done.
Loaded symbols for /usr/lib/libcrypto.so.13.0
Reading symbols from /usr/lib/libssl.so.11.0...done.
Loaded symbols for /usr/lib/libssl.so.11.0
#0 0x0461faa3 in mysql_st_prepare (sth=0x8315330c, imp_sth=0x7cd55100, statement=0x811ad600 "select * from interests where tag =? and site_hidden=0 and hidden=0 and confirmed=1",
attribs=0xfe) at dbdimp.c:2310
2310 col_type= (has_statement_fields ?
(gdb) bt
#0 0x0461faa3 in mysql_st_prepare (sth=0x8315330c, imp_sth=0x7cd55100, statement=0x811ad600 "select * from interests where tag =? and site_hidden=0 and hidden=0 and confirmed=1",
attribs=0xfe) at dbdimp.c:2310
#1 0x0462482c in XS_DBD__mysql__st__prepare (cv=0x7c166a74) at mysql.xsi:427
#2 0x0d9f1d08 in Perl_pp_entersub () at /usr/src/gnu/usr.bin/perl/pp_hot.c:2877
#3 0x0da1c5b9 in Perl_runops_standard () at /usr/src/gnu/usr.bin/perl/run.c:37
#4 0x0da03008 in S_call_body (myop=0xcf7eb250, is_eval=0 '\0') at /usr/src/gnu/usr.bin/perl/perl.c:2733
#5 0x0da02f2e in Perl_call_sv (sv=0x8315327c, flags=0) at /usr/src/gnu/usr.bin/perl/perl.c:2609
#6 0x08b42d3e in XS_DBI_dispatch () from /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/DBI/DBI .so
#7 0x0d9f1d08 in Perl_pp_entersub () at /usr/src/gnu/usr.bin/perl/pp_hot.c:2877
#8 0x0da1c5b9 in Perl_runops_standard () at /usr/src/gnu/usr.bin/perl/run.c:37
#9 0x0da025df in S_run_body (oldscope=1) at /usr/src/gnu/usr.bin/perl/perl.c:2368
#10 0x0da02533 in perl_run (my_perl=0x868a1030) at /usr/src/gnu/usr.bin/perl/perl.c:2285
#11 0x1c0012a6 in main ()
(gdb)
mysql info:
mysql-client-5.0.22 multithreaded SQL database (client)
mysql-server-5.0.21 multithreaded SQL database (server)
p5-DBD-mysql-3.0006_1 MySQL drivers for the Perl DBI
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=openbsd, osvers=4.0, archname=i386-openbsd
uname='openbsd'
config_args='-dsE -Dopenbsd_distribution=defined'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -I/usr/local/include',
optimize='-O2',
cppflags='-fno-strict-aliasing -fno-delete-null-pointer-checks -pipe -I/usr/local/include'
ccversion='', gccversion='3.3.5 (propolice)', gccosandvers='openbsd4.0'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-Wl,-E '
libpth=/usr/lib
libs=-lm -lutil -lc
perllibs=-lm -lutil -lc
libc=/usr/lib/libc.a, so=so, useshrplib=true, libperl=libperl.so.10.1
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-R/usr/libdata/perl5/i386-openbsd/5.8.8/CORE'
cccdlflags='-DPIC -fPIC ', lddlflags='-shared -fPIC '
Characteristics of this binary (from libperl):
Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO
Built under openbsd
@INC:
/usr/libdata/perl5/i386-openbsd/5.8.8
/usr/local/libdata/perl5/i386-openbsd/5.8.8
/usr/libdata/perl5
/usr/local/libdata/perl5
/usr/local/libdata/perl5/site_perl/i386-openbsd
/usr/libdata/perl5/site_perl/i386-openbsd
/usr/local/libdata/perl5/site_perl
/usr/libdata/perl5/site_perl
/usr/local/lib/perl5/site_perl
.
--
Irresponsibility: No single raindrop believes it is to blame for the flood
--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org