Subject: | SEGV when accessing $sth->{TYPE}->[$i] for a VIEW |
This seems similar to Case 8564, but maybe isn't exactly the same.
I get the SEGV reproducibly on the first attempt to get TYPE, but only
for a VIEW, not for a TABLE. I have no problem getting NAME, as 8564
reports. But 8564 seems to indicate that the symptom doesn't
occur reproducibly, so perhaps I've just not seen it yet. In
case this is the same bug (after all, they both involve access
to metadata), perhaps having a reproducible case will facilitate
debugging.
Here is a Perl program, the program output, and a stack trace
following the SEGV. As in Case 8564, I'm using DBD::SQLite,
which implies sqlite version 3.0.8. I've also reported this
issue to the sqlite-users list.
Show quoted text
> uname -a
Linux florence 2.4.20-24.7smp #1 SMP Mon Dec 1 13:18:03 EST 2003 i686 unknown
Show quoted text> perl -v
This is perl, v5.8.6 built for i686-linux-thread-multi
Thanks,
-Peter Shenkin.
Show quoted text---------- program -------------------
# $Id: dump_sqlite.pl,v 1.4 2005/04/14 21:01:14 shenkin Exp $
# Dump an sqlite DB to stdout
# Usage: "dump_sqlite <sqlite file name>
use strict;
use Carp;
use DBI;
# get db name from cmdline:
my $dbfile = $ARGV[0];
# make sure db is there:
if( not -e $dbfile ) {
confess "dumpdb: could not find sqlite file $dbfile\n";
}
# connect to db:
my $dbh = my $dbh = DBI->connect( "dbi:SQLite:dbname=$dbfile", "", "",
{ AutoCommit=>0,RaiseError=>1 } )
or confess "Could not connect to database $dbfile\n";
print "Connected to database $dbfile\n"
. " Binary values are shown as 'BLOB' and NULL values as 'NULL'\n";
print "DBI->installed_versions:\n";
DBI->installed_versions;
# NB: "all_properties" is a view:
my $sth = $dbh->prepare(" SELECT * FROM all_properties" );
print "sth->{NUM_OF_FIELDS}= $sth->{NUM_OF_FIELDS}\n";
print "sth->{NAME}->[1]= $sth->{NAME}->[1]\n";
print "sth->{TYPE}->[1]= $sth->{TYPE}->[1]\n";
---------- program output -------------------
Connected to database testform-node1_raw.sqlite
Binary values are shown as 'BLOB' and NULL values as 'NULL'
DBI->installed_versions:
Perl : 5.008006 (i686-linux-thread-multi)
OS : linux (2.4.20-28.7)
DBI : 1.47
DBD::Sponge : 11.10
DBD::SQLite : 1.07
DBD::Proxy : install_driver(Proxy) failed: Can't locate RPC/PlClient.pm in @INC
DBD::File : 0.32
DBD::ExampleP : 11.12
DBD::DBM : 0.02
sth->{NUM_OF_FIELDS}= 3
sth->{NAME}->[1]= name
Segmentation fault (core dumped)
---------- stack trace -------------------
#0 0x080bdac5 in Perl_newSVpv ()
#1 0x40230996 in sqlite_st_FETCH_attrib () from
/zone1/shenkin/bld/main/Linux-x86-g.ifort/mmshare-v1.5/lib/Linux-x86/perl5/site_perl/5.8.6/i686-linux-thread-multi/auto/DBD/SQLite/SQLite.so
#2 0x40222a91 in XS_DBD__SQLite__st_FETCH_attrib ()
from
/zone1/shenkin/bld/main/Linux-x86-g.ifort/mmshare-v1.5/lib/Linux-x86/perl5/site_perl/5.8.6/i686-linux-thread-multi/auto/DBD/SQLite/SQLite.so
#3 0x4020103c in XS_DBI_dispatch () from
/zone1/shenkin/bld/main/Linux-x86-g.ifort/mmshare-v1.5/lib/Linux-x86/perl5/site_perl/5.8.6/i686-linux-thread-multi/auto/DBI/DBI.so
#4 0x080b3ee4 in Perl_pp_entersub ()
#5 0x080ad680 in Perl_runops_standard ()
#6 0x08063939 in S_call_body ()
#7 0x080634b6 in Perl_call_sv ()
#8 0x080a49e1 in S_magic_methpack ()
#9 0x080a4add in Perl_magic_getpack ()
#10 0x080a29a0 in Perl_mg_get ()
#11 0x080b45f3 in Perl_vivify_ref ()
#12 0x080b1866 in Perl_pp_helem ()
#13 0x080ad680 in Perl_runops_standard ()
#14 0x08063048 in S_run_body ()
#15 0x08062d59 in perl_run ()
#16 0x0805fc45 in main ()
#17 0x400c11c4 in __libc_start_main () from /lib/libc.so.6