bioperl-live icon indicating copy to clipboard operation
bioperl-live copied to clipboard

Possible precedence issue with control flow operator at Bio/DB/IndexedBase.pm line 805

Open hyphaltip opened this issue 3 years ago • 3 comments

This warning has shown up for years --

https://github.com/bioperl/bioperl-live/blob/2b53e22cd3f61961ea9ac7707537a01e4bf75a73/lib/Bio/DB/IndexedBase.pm#L804

I don't remember the exact logic intended but should the return be inside the eval to avoid the ambiguity? Here's my proposed solution - anyone want to look and test - it seems to run okay when I change locally and am trying out in some limited tests.

    eval {
      return $self->_fhcache( File::Spec->catfile($self->{dirname}, $file));
    } or $self->throw( "Can't open file $file" );

hyphaltip avatar Feb 05 '21 00:02 hyphaltip

Seems like the logic is to die if the File::Spec->catfile($self->{dirname}, $file) call is performed; notably $@ isn't checked. I'm guessing it's okay to return from inside an eval, but I would do it something like the below, which is more explicit about the intent:

# completely untested
my $fh = eval {
     $self->_fhcache( File::Spec->catfile($self->{dirname}, $file));
    };
$self->throw( "Can't open file $file: $@" ) if $@;
return $fh;

cjfields avatar Feb 28 '21 16:02 cjfields

I am seeing this warning as well. It occurs for me when the current version of VEP (103.1) is installed using Bioconda, and VEP throws the warning at startup every time.

alanhoyle avatar Apr 23 '21 15:04 alanhoyle

This warning has been around for years. No one has dug in to fix though I think. Should be harmless but let’s fix it ...

On Fri, Apr 23, 2021 at 8:06 AM Alan Hoyle @.***> wrote:

I am seeing this warning as well. It occurs for me when the current version of VEP (103.1) is installed using Bioconda, and VEP throws the warning at startup every time.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bioperl/bioperl-live/issues/355#issuecomment-825722074, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAL5O44R3QO3COZ62T6AQTTKGEF3ANCNFSM4XDZJ2QA .

-- Sent from Gmail Mobile

Jason Stajich - @.***

hyphaltip avatar Apr 24 '21 18:04 hyphaltip