Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: ephraim.stevens [...] gmail.com
Cc:
AdminCc:

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



Subject: FTS tokenizer segfault
Date: Sat, 10 Dec 2011 08:21:17 -0500
To: bug-DBD-SQLite [...] rt.cpan.org
From: Ephraim Stevens <ephraim.stevens [...] gmail.com>
Gentleman, With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl tokenizer with the DBD::SQLite module and it segfaults. In fact, I'm using the example taken right out of the documentation. Can you please provide guidance? Maybe I'm missing something here. I tried this code USING FTS4 and FTS3 with the same results. Forgive me if I overlooked something basic. Thanks in advance for your help. Here is the code: -------------------------------------------------------------------------------------------------------------------------------------------- #!/usr/bin/perl use DBD::SQLite; my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { ShowErrorStatement => 1} ) or die $DBI::errstr; sub locale_tokenizer { return sub { my $string = shift; use locale; my $regex = qr/\w+/; my $term_index = 0; return sub { # closure $string =~ /$regex/g or return; # either match, or no more token my ($start, $end) = ($-[0], $+[0]); my $len = $end-$start; my $term = substr($string, $start, $len); return ($term, $len, $start, $end, $term_index++); } }; } $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, tokenize=perl, "main::locale_tokenizer");'); ------------------------------------------------------------------------------------------------------------------------------------------------ Test run: root@ln:/usr/local/dbperl# ./test.pl Segmentation fault
Hi. What's causing the segfault for you is a comma (,) after "tokenize=perl". Remove it and your script should work fine. Also, if your environment doesn't support proper locale, it might cause another segfault. For now I close this ticket as resolved. If you still have the same issue, please reopen this, or send us an email via mailing list. Thanks. On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote: Show quoted text
> Gentleman, > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > tokenizer > with the DBD::SQLite module and it segfaults. In fact, I'm using the > example taken right out of the documentation. Can you please provide > guidance? Maybe I'm missing something here. > > I tried this code USING FTS4 and FTS3 with the same results. Forgive > me if > I overlooked something basic. Thanks in advance for your help. Here > is the > code: > >
-------------------------------------------------------------------------------------------------------------------------------------------- Show quoted text
> #!/usr/bin/perl > > use DBD::SQLite; > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > ShowErrorStatement => 1} > ) or die $DBI::errstr; > > sub locale_tokenizer { > return sub { > my $string = shift; > > use locale; > my $regex = qr/\w+/; > my $term_index = 0; > > return sub { # closure > $string =~ /$regex/g or return; # either match, or no more > token > my ($start, $end) = ($-[0], $+[0]); > my $len = $end-$start; > my $term = substr($string, $start, $len); > return ($term, $len, $start, $end, $term_index++); > } > }; > } > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > tokenize=perl, "main::locale_tokenizer");'); >
------------------------------------------------------------------------------------------------------------------------------------------------ Show quoted text
> > Test run: > > root@ln:/usr/local/dbperl# ./test.pl > Segmentation fault
Subject: Re: [rt.cpan.org #73159] FTS tokenizer segfault
Date: Sun, 11 Dec 2011 19:35:29 -0500
To: bug-DBD-SQLite [...] rt.cpan.org
From: "ephraim.stevens [...] gmail.com" <ephraim.stevens [...] gmail.com>
Thank you. That worked Show quoted text
----- Reply message ----- From: "Kenichi Ishigaki via RT" <bug-DBD-SQLite@rt.cpan.org> To: <ephraim.stevens@gmail.com> Subject: [rt.cpan.org #73159] FTS tokenizer segfault Date: Sun, Dec 11, 2011 12:21 pm <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > Hi. What's causing the segfault for you is a comma (,) after "tokenize=perl". Remove it and your script should work fine. Also, if your environment doesn't support proper locale, it might cause another segfault. For now I close this ticket as resolved. If you still have the same issue, please reopen this, or send us an email via mailing list. Thanks. On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> Gentleman, > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > tokenizer > with the DBD::SQLite module and it segfaults. In fact, I'm using the > example taken right out of the documentation. Can you please provide > guidance? Maybe I'm missing something here. > > I tried this code USING FTS4 and FTS3 with the same results. Forgive > me if > I overlooked something basic. Thanks in advance for your help. Here > is the > code: > >
--------------------------------------------------------------------------------------------------------------------------------------------
> #!/usr/bin/perl > > use DBD::SQLite; > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > ShowErrorStatement => 1} > ) or die $DBI::errstr; > > sub locale_tokenizer { > return sub { > my $string = shift; > > use locale; > my $regex = qr/\w+/; > my $term_index = 0; > > return sub { # closure > $string =~ /$regex/g or return; # either match, or no more > token > my ($start, $end) = ($-[0], $+[0]); > my $len = $end-$start; > my $term = substr($string, $start, $len); > return ($term, $len, $start, $end, $term_index++); > } > }; > } > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > tokenize=perl, "main::locale_tokenizer");'); >
------------------------------------------------------------------------------------------------------------------------------------------------
> > Test run: > > root@ln:/usr/local/dbperl# ./test.pl > Segmentation fault
Good. Patched the trunk to raise an error (instead of segfault) in this case. Thanks. On Mon Dec 12 09:35:25 2011, ephraim.stevens@gmail.com wrote: Show quoted text
> Thank you. That worked > > > > ----- Reply message ----- > From: "Kenichi Ishigaki via RT" <bug-DBD-SQLite@rt.cpan.org> > To: <ephraim.stevens@gmail.com> > Subject: [rt.cpan.org #73159] FTS tokenizer segfault > Date: Sun, Dec 11, 2011 12:21 pm > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > Hi. What's causing the segfault for you is a comma (,) after > "tokenize=perl". Remove it and your script should work fine. Also, if > your environment doesn't support proper locale, it might cause another > segfault. For now I close this ticket as resolved. If you still have > the same issue, please reopen this, or send us an email via mailing > list. Thanks. > > On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> > Gentleman, > > > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > > tokenizer > > with the DBD::SQLite module and it segfaults. In fact, I'm using the > > example taken right out of the documentation. Can you please provide > > guidance? Maybe I'm missing something here. > > > > I tried this code USING FTS4 and FTS3 with the same results.
> Forgive
> > me if > > I overlooked something basic. Thanks in advance for your help. Here > > is the > > code: > > > >
>
-------------------------------------------------------------------------------------------------------------------------------------------- Show quoted text
> > #!/usr/bin/perl > > > > use DBD::SQLite; > > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > > ShowErrorStatement => 1} > > ) or die $DBI::errstr; > > > > sub locale_tokenizer { > > return sub { > > my $string = shift; > > > > use locale; > > my $regex = qr/\w+/; > > my $term_index = 0; > > > > return sub { # closure > > $string =~ /$regex/g or return; # either match, or no
> more
> > token > > my ($start, $end) = ($-[0], $+[0]); > > my $len = $end-$start; > > my $term = substr($string, $start, $len); > > return ($term, $len, $start, $end, $term_index++); > > } > > }; > > } > > > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > > tokenize=perl, "main::locale_tokenizer");'); > >
>
------------------------------------------------------------------------------------------------------------------------------------------------ Show quoted text
> > > > Test run: > > > > root@ln:/usr/local/dbperl# ./test.pl > > Segmentation fault
> > >
Subject: Re: [rt.cpan.org #73159] FTS tokenizer segfault
Date: Mon, 12 Dec 2011 14:22:51 -0500
To: bug-DBD-SQLite [...] rt.cpan.org
From: Ephraim Stevens <ephraim.stevens [...] gmail.com>
Your team is doing superb work on this module. It's my most widely used module. On Dec 11, 2011 9:41 PM, "Kenichi Ishigaki via RT" < bug-DBD-SQLite@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > Good. Patched the trunk to raise an error (instead of segfault) in this > case. Thanks. > > On Mon Dec 12 09:35:25 2011, ephraim.stevens@gmail.com wrote:
> > Thank you. That worked > > > > > > > > ----- Reply message ----- > > From: "Kenichi Ishigaki via RT" <bug-DBD-SQLite@rt.cpan.org> > > To: <ephraim.stevens@gmail.com> > > Subject: [rt.cpan.org #73159] FTS tokenizer segfault > > Date: Sun, Dec 11, 2011 12:21 pm > > > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > > > Hi. What's causing the segfault for you is a comma (,) after > > "tokenize=perl". Remove it and your script should work fine. Also, if > > your environment doesn't support proper locale, it might cause another > > segfault. For now I close this ticket as resolved. If you still have > > the same issue, please reopen this, or send us an email via mailing > > list. Thanks. > > > > On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> > > Gentleman, > > > > > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > > > tokenizer > > > with the DBD::SQLite module and it segfaults. In fact, I'm using the > > > example taken right out of the documentation. Can you please provide > > > guidance? Maybe I'm missing something here. > > > > > > I tried this code USING FTS4 and FTS3 with the same results.
> > Forgive
> > > me if > > > I overlooked something basic. Thanks in advance for your help. Here > > > is the > > > code: > > > > > >
> >
> > --------------------------------------------------------------------------------------------------------------------------------------------
> > > #!/usr/bin/perl > > > > > > use DBD::SQLite; > > > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > > > ShowErrorStatement => 1} > > > ) or die $DBI::errstr; > > > > > > sub locale_tokenizer { > > > return sub { > > > my $string = shift; > > > > > > use locale; > > > my $regex = qr/\w+/; > > > my $term_index = 0; > > > > > > return sub { # closure > > > $string =~ /$regex/g or return; # either match, or no
> > more
> > > token > > > my ($start, $end) = ($-[0], $+[0]); > > > my $len = $end-$start; > > > my $term = substr($string, $start, $len); > > > return ($term, $len, $start, $end, $term_index++); > > > } > > > }; > > > } > > > > > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > > > tokenize=perl, "main::locale_tokenizer");'); > > >
> >
> > ------------------------------------------------------------------------------------------------------------------------------------------------
> > > > > > Test run: > > > > > > root@ln:/usr/local/dbperl# ./test.pl > > > Segmentation fault
> > > > > >
> > > >
Subject: Re: [rt.cpan.org #73159] FTS tokenizer segfault
Date: Wed, 11 Jan 2012 15:15:32 -0500
To: bug-DBD-SQLite [...] rt.cpan.org
From: Ephraim Stevens <ephraim.stevens [...] gmail.com>
Dbd-sqlite Team, Is the sqlite_trace function available under dbd-sqlite: http://www.sqlite.org/c3ref/profile.html On Dec 11, 2011 12:21 PM, "Kenichi Ishigaki via RT" < bug-DBD-SQLite@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > Hi. What's causing the segfault for you is a comma (,) after > "tokenize=perl". Remove it and your script should work fine. Also, if > your environment doesn't support proper locale, it might cause another > segfault. For now I close this ticket as resolved. If you still have > the same issue, please reopen this, or send us an email via mailing > list. Thanks. > > On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> > Gentleman, > > > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > > tokenizer > > with the DBD::SQLite module and it segfaults. In fact, I'm using the > > example taken right out of the documentation. Can you please provide > > guidance? Maybe I'm missing something here. > > > > I tried this code USING FTS4 and FTS3 with the same results. Forgive > > me if > > I overlooked something basic. Thanks in advance for your help. Here > > is the > > code: > > > >
> > --------------------------------------------------------------------------------------------------------------------------------------------
> > #!/usr/bin/perl > > > > use DBD::SQLite; > > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > > ShowErrorStatement => 1} > > ) or die $DBI::errstr; > > > > sub locale_tokenizer { > > return sub { > > my $string = shift; > > > > use locale; > > my $regex = qr/\w+/; > > my $term_index = 0; > > > > return sub { # closure > > $string =~ /$regex/g or return; # either match, or no more > > token > > my ($start, $end) = ($-[0], $+[0]); > > my $len = $end-$start; > > my $term = substr($string, $start, $len); > > return ($term, $len, $start, $end, $term_index++); > > } > > }; > > } > > > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > > tokenize=perl, "main::locale_tokenizer");'); > >
> > ------------------------------------------------------------------------------------------------------------------------------------------------
> > > > Test run: > > > > root@ln:/usr/local/dbperl# ./test.pl > > Segmentation fault
> > > >
No public one yet. I have just implemented it in the trunk ;) And please don't reuse old threads for different topics. Create a new one for better maintenance. Thanks. On Thu Jan 12 05:15:45 2012, ephraim.stevens@gmail.com wrote: Show quoted text
> Dbd-sqlite Team, > > Is the sqlite_trace function available under dbd-sqlite: > > http://www.sqlite.org/c3ref/profile.html > On Dec 11, 2011 12:21 PM, "Kenichi Ishigaki via RT" < > bug-DBD-SQLite@rt.cpan.org> wrote: >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > > > Hi. What's causing the segfault for you is a comma (,) after > > "tokenize=perl". Remove it and your script should work fine. Also,
> if
> > your environment doesn't support proper locale, it might cause
> another
> > segfault. For now I close this ticket as resolved. If you still have > > the same issue, please reopen this, or send us an email via mailing > > list. Thanks. > > > > On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> > > Gentleman, > > > > > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > > > tokenizer > > > with the DBD::SQLite module and it segfaults. In fact, I'm using
> the
> > > example taken right out of the documentation. Can you please
> provide
> > > guidance? Maybe I'm missing something here. > > > > > > I tried this code USING FTS4 and FTS3 with the same results.
> Forgive
> > > me if > > > I overlooked something basic. Thanks in advance for your help.
> Here
> > > is the > > > code: > > > > > >
> > > >
>
------------------------------------------------------------------------ -------------------------------------------------------------------- Show quoted text
> > > #!/usr/bin/perl > > > > > > use DBD::SQLite; > > > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > > > ShowErrorStatement => 1} > > > ) or die $DBI::errstr; > > > > > > sub locale_tokenizer { > > > return sub { > > > my $string = shift; > > > > > > use locale; > > > my $regex = qr/\w+/; > > > my $term_index = 0; > > > > > > return sub { # closure > > > $string =~ /$regex/g or return; # either match, or no
> more
> > > token > > > my ($start, $end) = ($-[0], $+[0]); > > > my $len = $end-$start; > > > my $term = substr($string, $start, $len); > > > return ($term, $len, $start, $end, $term_index++); > > > } > > > }; > > > } > > > > > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > > > tokenize=perl, "main::locale_tokenizer");'); > > >
> > > >
>
------------------------------------------------------------------------ ------------------------------------------------------------------------ Show quoted text
> > > > > > Test run: > > > > > > root@ln:/usr/local/dbperl# ./test.pl > > > Segmentation fault
> > > > > > > >
Subject: Re: [rt.cpan.org #73159] FTS tokenizer segfault
Date: Thu, 12 Jan 2012 05:49:01 -0500
To: bug-DBD-SQLite [...] rt.cpan.org
From: Ephraim Stevens <ephraim.stevens [...] gmail.com>
Will do... Thank you as well :) On Jan 12, 2012 12:44 AM, "Kenichi Ishigaki via RT" < bug-DBD-SQLite@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > No public one yet. I have just implemented it in the trunk ;) > > And please don't reuse old threads for different topics. Create a new > one for better maintenance. Thanks. > > On Thu Jan 12 05:15:45 2012, ephraim.stevens@gmail.com wrote:
> > Dbd-sqlite Team, > > > > Is the sqlite_trace function available under dbd-sqlite: > > > > http://www.sqlite.org/c3ref/profile.html > > On Dec 11, 2011 12:21 PM, "Kenichi Ishigaki via RT" < > > bug-DBD-SQLite@rt.cpan.org> wrote: > >
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=73159 > > > > > > > Hi. What's causing the segfault for you is a comma (,) after > > > "tokenize=perl". Remove it and your script should work fine. Also,
> > if
> > > your environment doesn't support proper locale, it might cause
> > another
> > > segfault. For now I close this ticket as resolved. If you still have > > > the same issue, please reopen this, or send us an email via mailing > > > list. Thanks. > > > > > > On Sat Dec 10 22:21:26 2011, ephraim.stevens@gmail.com wrote:
> > > > Gentleman, > > > > > > > > With DBD::SQLite 1.33 and 1.35, I am trying to use a custom perl > > > > tokenizer > > > > with the DBD::SQLite module and it segfaults. In fact, I'm using
> > the
> > > > example taken right out of the documentation. Can you please
> > provide
> > > > guidance? Maybe I'm missing something here. > > > > > > > > I tried this code USING FTS4 and FTS3 with the same results.
> > Forgive
> > > > me if > > > > I overlooked something basic. Thanks in advance for your help.
> > Here
> > > > is the > > > > code: > > > > > > > >
> > > > > >
> >
> ------------------------------------------------------------------------ > --------------------------------------------------------------------
> > > > #!/usr/bin/perl > > > > > > > > use DBD::SQLite; > > > > my $dbh = DBI->connect("dbi:SQLite:dbname=fts.db","","", { > > > > ShowErrorStatement => 1} > > > > ) or die $DBI::errstr; > > > > > > > > sub locale_tokenizer { > > > > return sub { > > > > my $string = shift; > > > > > > > > use locale; > > > > my $regex = qr/\w+/; > > > > my $term_index = 0; > > > > > > > > return sub { # closure > > > > $string =~ /$regex/g or return; # either match, or no
> > more
> > > > token > > > > my ($start, $end) = ($-[0], $+[0]); > > > > my $len = $end-$start; > > > > my $term = substr($string, $start, $len); > > > > return ($term, $len, $start, $end, $term_index++); > > > > } > > > > }; > > > > } > > > > > > > > $dbh->do('CREATE VIRTUAL TABLE FIXMESSAGE USING FTS3(MESSAGE, > > > > tokenize=perl, "main::locale_tokenizer");'); > > > >
> > > > > >
> >
> ------------------------------------------------------------------------ > ------------------------------------------------------------------------
> > > > > > > > Test run: > > > > > > > > root@ln:/usr/local/dbperl# ./test.pl > > > > Segmentation fault
> > > > > > > > > > > >
> > > >
DBD::SQLite 1.36_01 with the fix is released. Thanks.