Unnecessary warnings in CircCommon.pm caused by hash initialization

Bug #1564378 reported by Jason Boyer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Unassigned
2.10
Fix Released
Undecided
Unassigned
2.8
Fix Released
Undecided
Unassigned
2.9
Fix Released
Undecided
Unassigned

Bug Description

Evergreen version: All supported
Others: N/A

Any time that a particular code path in the extend_grade_period function of CircCommon.pm is called there will be a "Reference found where even-sized list expected at ..." warning emitted because a hash is initialized like so: my %hash = {}; when it should just be my %hash; The good news is that this appears to be the last of this style of hash initialization in Evergreen, so let's finally oil this last squeaky wheel. One liner branch incoming.

Revision history for this message
Jason Boyer (jboyer) wrote :
Changed in evergreen:
milestone: none → 2.next
importance: Undecided → Low
Jason Boyer (jboyer)
summary: - Unnecessary hash initialization in CircCommon.pm causes warnings
+ Unnecessary warnings in CircCommon.pm caused by hash initialization
Revision history for this message
Jason Stephenson (jstephenson) wrote :

Is there some specific call with certain parameters that can be made to reliably reproduce this message?

That said, the code change looks harmless.

BTW,

my %hash = ();

will also work, will not generate a warning, and is probably what the author meant.

Don't think it really makes a difference in the functionality, though.

Revision history for this message
Jason Boyer (jboyer) wrote :

I may have been a little light on details I suppose. The change should be harmless though; I tested the current style against the implied undef style in my patch with a little throwaway perl program and it worked the same either way, though if %hash = (); is more idiomatic for hashes that's fine with me too. A quick grep -r shows that both types are used: 33 () to 143 undef.

I'm seeing it during fine generation during calls to open-ils.storage.action.circulation.overdue.generate_fines. These conditions have to be true to hit the warning (which they were here about 2000 times this morning. D: ):
It has to be the first Overdue fine applied to a transaction to call extend_grace_period
Grace period must be 24 hours or longer
The circ_lib must enable the circ.grace.extend OU and have hours of operation specified for at least one day
If all of the above are true the code will finally reach the line that triggers the warning.

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I have confirmed this behavior on 2.9 and master.

I'll have a look at the branch tomorrow morning and load it for testing.

As mentioned above, it looks like a straightforward change.

Changed in evergreen:
status: New → Confirmed
assignee: nobody → Jason Stephenson (jstephenson)
Revision history for this message
Jason Stephenson (jstephenson) wrote :

I tested this and it works for me.

However, since the branch has no tests, a third signoff is required.

I pushed the branch with my signoff to collab/dyrcona/lp1564378_shush_you-signoff

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/dyrcona/lp1564378_shush_you-signoff

Please use this branch when testing/signing off for the final commit.

tags: added: pullrequest signedoff
Changed in evergreen:
assignee: Jason Stephenson (jstephenson) → nobody
Revision history for this message
Mike Rylander (mrylander) wrote :

Picked and pushed to 2.8-2.10. Thanks, Jasons!

Changed in evergreen:
status: Confirmed → Fix Committed
Revision history for this message
Mike Rylander (mrylander) wrote :

And master ... of course.

Changed in evergreen:
status: Fix Committed → Fix Released
Changed in evergreen:
milestone: 2.next → 2.11-alpha
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.