[Bioperl-l] Query re segementation error from Bio::Index::Fasta

Peter Schattner schattner@alum.mit.edu
Mon, 16 Dec 2002 11:03:32 -0800


Hi folks

I'm not sure whether I've found a bug or I'm just being dumb.

When I run this test script:
###########

#! /usr/local/bin/perl -w

use strict;
use Bio::Index::Fasta;
my $inx = Bio::Index::Fasta->new('-filename' =>
'/home/peter/genome_data/yeast/Other_yeast.index');

exit(0);

sub test {
    my ($record_id) = @_;
    my $record;
    if ($record_id) {  $record = $inx->fetch($record_id)};
}
###########

I get:

[peter@pschattner test]$ perl -w scripts/test-debug.segfault.pl
Segmentation fault

When I move one line so the script reads:
###########

#! /usr/local/bin/perl -w

use strict;
use Bio::Index::Fasta;

exit(0);

sub test {
    my ($record_id) = @_;
    my $record;
    my $inx = Bio::Index::Fasta->new('-filename' =>
'/home/peter/genome_data/yeast/Other_yeast.index');
    if ($record_id) {  $record = $inx->fetch($record_id)};
}
###########

The segmentation fault message goes away:
[peter@pschattner test]$ perl -w scripts/test-debug.seg-no-fault.pl
[peter@pschattner test]$

Although moving the line has solved my problem, I would sure like to
know why the first script crashes. Is the first script doing something
illegal or is there a bug in Bio::Index?

Thanks

Peter