Skip Menu |

This queue is for tickets about the Tie-LevelDB CPAN distribution.

Report information
The Basics
Id: 71385
Status: resolved
Priority: 0/
Queue: Tie-LevelDB

People
Owner: Nobody in particular
Requestors: dgl [...] dgl.cx
Cc:
AdminCc:

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



CC: David Leadbeater <dgl [...] dgl.cx>
Subject: [PATCH] Raise Perl level exception on error
Date: Sat, 1 Oct 2011 18:17:38 +0100
To: bug-Tie-LevelDB [...] rt.cpan.org
From: David Leadbeater <dgl [...] dgl.cx>
Avoids segfaulting on attempting to open a locked DB. --- LevelDB.xs | 4 +++- t/Tie-LevelDB.t | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/LevelDB.xs b/LevelDB.xs index 59e29aa..a7aa9bb 100644 --- a/LevelDB.xs +++ b/LevelDB.xs @@ -22,7 +22,9 @@ extern "C" { #include<leveldb/write_batch.h> void status_assert(leveldb::Status s) { - if(!s.ok()) std::cerr << s.ToString() << std::endl; + if(!s.ok()) { + croak(s.ToString().c_str()); + } } class Iterator { diff --git a/t/Tie-LevelDB.t b/t/Tie-LevelDB.t index f496946..887568f 100644 --- a/t/Tie-LevelDB.t +++ b/t/Tie-LevelDB.t @@ -5,7 +5,7 @@ # change 'tests => 1' to 'tests => last_test_to_print'; -use Test::More tests => 29; +use Test::More tests => 30; BEGIN { use_ok('Tie::LevelDB') }; ######################### @@ -87,6 +87,15 @@ delete $h{'goner2'}; is(scalar(keys %h), 2); +open my $fh, "|-", $^X, "-Mblib" or die $!; +print $fh <<EOF; +use $LevelDB_Class; +eval { tie my %h, "$LevelDB_Class", "$DBDIR" }; +die if \$@ !~ /LOCK/; +EOF +close $fh; +ok +($? >> 8) == 0, "Unable to open locked DB"; + untie %h; is(scalar(keys %h), 0); -- 1.7.4.4
CC: David Leadbeater <dgl [...] dgl.cx>
Subject: [PATCH] [rt.cpan.org #71385] Missed format string
Date: Sat, 1 Oct 2011 21:25:47 +0100
To: bug-Tie-LevelDB [...] rt.cpan.org
From: David Leadbeater <dgl [...] dgl.cx>
[I missed the format string in the previous patch.] --- LevelDB.xs | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/LevelDB.xs b/LevelDB.xs index a7aa9bb..71ad3c4 100644 --- a/LevelDB.xs +++ b/LevelDB.xs @@ -23,7 +23,7 @@ extern "C" { void status_assert(leveldb::Status s) { if(!s.ok()) { - croak(s.ToString().c_str()); + croak("%s", s.ToString().c_str()); } } -- 1.7.4.4
Subject: Re: [rt.cpan.org #71385] [PATCH] Raise Perl level exception on error
Date: Mon, 3 Oct 2011 10:51:08 +0200
To: bug-Tie-LevelDB [...] rt.cpan.org
From: Martin Sarfy <martin [...] sarfy.cz>
Thank you! I've included your patches in 0.06. Please feel free to change Slice typemap if you want, I will include all your changes. Thanks and have a nice day, Martin On Sat, Oct 1, 2011 at 7:17 PM, David Leadbeater via RT < bug-Tie-LevelDB@rt.cpan.org> wrote: Show quoted text
> Sat Oct 01 13:17:53 2011: Request 71385 was acted upon. > Transaction: Ticket created by DGL > Queue: Tie-LevelDB > Subject: [PATCH] Raise Perl level exception on error > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: dgl@dgl.cx > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=71385 > > > > Avoids segfaulting on attempting to open a locked DB. > --- > LevelDB.xs | 4 +++- > t/Tie-LevelDB.t | 11 ++++++++++- > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/LevelDB.xs b/LevelDB.xs > index 59e29aa..a7aa9bb 100644 > --- a/LevelDB.xs > +++ b/LevelDB.xs > @@ -22,7 +22,9 @@ extern "C" { > #include<leveldb/write_batch.h> > > void status_assert(leveldb::Status s) { > - if(!s.ok()) std::cerr << s.ToString() << std::endl; > + if(!s.ok()) { > + croak(s.ToString().c_str()); > + } > } > > class Iterator { > diff --git a/t/Tie-LevelDB.t b/t/Tie-LevelDB.t > index f496946..887568f 100644 > --- a/t/Tie-LevelDB.t > +++ b/t/Tie-LevelDB.t > @@ -5,7 +5,7 @@ > > # change 'tests => 1' to 'tests => last_test_to_print'; > > -use Test::More tests => 29; > +use Test::More tests => 30; > BEGIN { use_ok('Tie::LevelDB') }; > > ######################### > @@ -87,6 +87,15 @@ delete $h{'goner2'}; > > is(scalar(keys %h), 2); > > +open my $fh, "|-", $^X, "-Mblib" or die $!; > +print $fh <<EOF; > +use $LevelDB_Class; > +eval { tie my %h, "$LevelDB_Class", "$DBDIR" }; > +die if \$@ !~ /LOCK/; > +EOF > +close $fh; > +ok +($? >> 8) == 0, "Unable to open locked DB"; > + > untie %h; > > is(scalar(keys %h), 0); > -- > 1.7.4.4 > > >
-- Martin Šárfy
It has been fixed long time ago, now I am just closing the request...