Skip Menu |
 

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 28757
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: ml_57uk [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Segfault on repeated inserts
Date: Thu, 9 Aug 2007 04:46:59 -0700 (PDT)
To: bug-DBD-SQLite [...] rt.cpan.org
From: Martin Lavery <ml_57uk [...] yahoo.com>
Download (untitled) / with headers
text/plain 433b
Hi, I get a segfault on repeated INSERTS where a unique column already exists. The attached code reproduces the bug on two different machines. Many thanks for a great module otherwise, Michael Show quoted text
____________________________________________________________________________________ Park yourself in front of a world of choices in alternative vehicles. Visit the Yahoo! Auto Green Center. http://autos.yahoo.com/green_center/
Download bug.pl
text/x-perl 3.8k
#!/usr/bin/perl use DBI; # DBD::SQlite-1.13 # $dsn="DBI:SQLite:dbname=te.db"; $dbh=DBI->connect($dsn); $dbh->do('CREATE TABLE "cons" ( "code" varchar(10) NOT NULL default \'\', "expansion" varchar(40) default NULL, PRIMARY KEY ("code"));'); my $insert_cons=$dbh->prepare("INSERT INTO cons (code,expansion) VALUES (?,?)") or die; $sendercode="foo"; $senderlong="bar"; $i=10; do { $insert_cons->execute($sendercode,$senderlong); } while ($i--); #Summary of my perl5 (revision 5 version 8 subversion 8) configuration: # Platform: # osname=linux, osvers=2.6.21.1, archname=i686-linux # uname='linux 11122-histopath 2.6.21.1 #1 smp wed may 2 16:49:45 gmt 2007 i686 intel(r) pentium(r) d cpu 2.80ghz genuineintel gnulinux ' # config_args='-des -Darchname=i686-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=i686-pc-linux-gnu-gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth= -Doptimize=-O2 -march=pentium4 -fomit-frame-pointer -pipe -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dinc_version_list=5.8.0 5.8.0/i686-linux 5.8.2 5.8.2/i686-linux 5.8.4 5.8.4/i686-linux 5.8.5 5.8.5/i686-linux 5.8.6 5.8.6/i686-linux 5.8.7 5.8.7/i686-linux -Dinc_version_list=5.8.0 5.8.0/i686-linux 5.8.2 5.8.2/i686-linux 5.8.4 5.8.4/i686-linux 5.8.5 5.8.5/i686-linux 5.8.6 5.8.6/i686-linux 5.8.7 5.8.7/i686-linux -Dcf_by=Gentoo -Ud_csh -Dusenm -Di_ndbm -Di_gdbm -Di_db' # 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='i686-pc-linux-gnu-gcc', ccflags ='-fno-strict-aliasing -pipe -Wdeclaration-after-statement -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', # optimize='-O2 -march=pentium4 -fomit-frame-pointer -pipe', # cppflags='-fno-strict-aliasing -pipe -Wdeclaration-after-statement' # ccversion='', gccversion='3.4.6 (Gentoo 3.4.6-r2, ssp-3.4.6-1.0, pie-8.7.10)', gccosandvers='' # 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='i686-pc-linux-gnu-gcc', ldflags =' -L/usr/local/lib' # libpth=/usr/local/lib /lib /usr/lib # libs=-lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc # perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc # libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a # gnulibc_version='2.5' # Dynamic Linking: # dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' # cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' # # #Characteristics of this binary (from libperl): # Compile-time options: PERL_MALLOC_WRAP USE_LARGE_FILES USE_PERLIO # Built under linux # Compiled at Aug 8 2007 09:15:29 # @INC: # /etc/perl # /usr/lib/perl5/vendor_perl/5.8.8/i686-linux # /usr/lib/perl5/vendor_perl/5.8.8 # /usr/lib/perl5/vendor_perl/5.8.7 # /usr/lib/perl5/vendor_perl/5.8.7/i686-linux # /usr/lib/perl5/vendor_perl # /usr/lib/perl5/site_perl/5.8.8/i686-linux # /usr/lib/perl5/site_perl/5.8.8 # /usr/lib/perl5/site_perl/5.8.6 # /usr/lib/perl5/site_perl/5.8.6/i686-linux # /usr/lib/perl5/site_perl/5.8.7 # /usr/lib/perl5/site_perl/5.8.7/i686-linux # /usr/lib/perl5/site_perl # /usr/lib/perl5/5.8.8/i686-linux # /usr/lib/perl5/5.8.8 # /usr/local/lib/site_perl # . #Linux 11122-Histopath 2.6.21.1 #1 SMP Wed May 2 16:49:45 GMT 2007 i686 #Intel(R) Pentium(R) D CPU 2.80GHz GenuineIntel GNU/Linux
Subject: Re: [rt.cpan.org #28757] Segfault on repeated inserts
Date: Thu, 9 Aug 2007 08:19:35 -0700 (PDT)
To: bug-DBD-SQLite [...] rt.cpan.org
From: Martin Lavery <ml_57uk [...] yahoo.com>
Download (untitled) / with headers
text/plain 428b
Addendum: DBDL::SQLite2 behaves correctly, with the message DBD::SQLite2::st execute failed: column code is not unique(1) at dbdimp.c line 419 at bug2.pl line 14 and moving on through the loop. M Show quoted text
____________________________________________________________________________________ Shape Yahoo! in your own image. Join our Network Research Panel today! http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
CC: matt [...] sergeant.org
Subject: Re: [rt.cpan.org #28757] Segfault on repeated inserts : PATCH
Date: Fri, 10 Aug 2007 07:30:55 -0700 (PDT)
To: bug-DBD-SQLite [...] rt.cpan.org
From: Martin Lavery <ml_57uk [...] yahoo.com>
Download (untitled) / with headers
text/plain 716b
I think I have solved it. The problem is in dbdimp.c. If a prepared statement fails, then the handle is destroyed rather than reset. When it is next used the handle is invalid and a segfault results (this happens in line 386 with sqlite3_bind_text). The solution appears to be to reset (sqlite3_reset()) rather than destroy (sqlite3_finalize()) the handle. I suspect this arose due to similarity of function names between sqlite2 and sqlite3. Patch attached. M Show quoted text
____________________________________________________________________________________ Fussy? Opinionated? Impossible to please? Perfect. Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7

Message body is not shown because sender requested not to inline it.

Unable to replicate with the code in svn.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.