SIP Precedence Warning, possible logic issue

Bug #1519879 reported by Josh Stompro on 2015-11-25
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

EG 2.8.4
Perl 5.20.2

I've got a bunch of warnings in my sip logs that say

Possible precedence issue with control flow operator at /usr/local/share/perl/5.20.2/OpenILS/SIP/ line 314.

The code looks like the following:

 312 return
 313 !$circ_is_blocked and
 314 $u->active eq 't' and
 315 $u->card->active eq 't';
 316 };a=blob;f=Open-ILS/src/perlmods/lib/OpenILS/SIP/;h=ac4f05c3b2b42fbc1f88c413db5917de9c897946;hb=HEAD#l294

I believe that is being interpreted as
(return !$circ_is_blocked) and $u->active eq 't' and $u->card->active eq 't';

So the only check that actually matters is the !circ_is_blocked, the active check and card active check are never reached.

The warning is described at

"not", "and", "or" are considered low precedence operators in perl.

So the solution is to either use a high precedence 'and' (&&) or use parentheses around the checks. But I would like a second opinion.


Tags: sip Edit Tag help
Galen Charlton (gmc) on 2015-11-25
Changed in evergreen:
status: New → Confirmed
Galen Charlton (gmc) wrote :

I confirm that there is indeed a precedence bug.

Changed in evergreen:
assignee: nobody → Josh Stompro (u-launchpad-stompro-org)
Jeff Godin (jgodin) on 2016-06-03
Changed in evergreen:
assignee: Josh Stompro (u-launchpad-stompro-org) → Jeff Godin (jgodin)
tags: added: sip
Changed in evergreen:
assignee: Jeff Godin (jgodin) → Jason Stephenson (jstephenson)
milestone: none → 3.3-rc
Jason Stephenson (jstephenson) wrote :

This was fixed as part of the fix for bug 1659928 that was included in Evergreen 3.0 beta.

no longer affects: evergreen/3.1
no longer affects: evergreen/3.2
Changed in evergreen:
assignee: Jason Stephenson (jstephenson) → nobody
milestone: 3.3-rc → none
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers