Bug 11587 - IsSuperLibrarian generates warnings
Summary: IsSuperLibrarian generates warnings
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low trivial (vote)
Assignee: Mark Tompsett
QA Contact: Testopia
URL:
Keywords:
: 11893 (view as bug list)
Depends on: 10277
Blocks:
  Show dependency treegraph
 
Reported: 2014-01-21 05:24 UTC by Mark Tompsett
Modified: 2015-06-04 23:30 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11587 - IsSuperLibrarian generates warnings (946 bytes, patch)
2014-01-21 05:50 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (1.61 KB, patch)
2014-01-21 05:51 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (946 bytes, patch)
2014-01-21 05:51 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (1.67 KB, patch)
2014-01-24 07:57 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (1000 bytes, patch)
2014-01-24 07:58 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (UT) (1.74 KB, patch)
2014-01-24 12:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11587 - IsSuperLibrarian generates warnings (1.04 KB, patch)
2014-01-24 12:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11587 - Add UT for IsSuperLibrarian if flags == 0 (1.30 KB, patch)
2014-01-24 12:05 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Tompsett 2014-01-21 05:24:47 UTC
If userenv->{flags} is undefined, the modulus 2 generates floody entries.
Comment 1 Mark Tompsett 2014-01-21 05:50:36 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2014-01-21 05:51:10 UTC Comment hidden (obsolete)
Comment 3 Mark Tompsett 2014-01-21 05:51:20 UTC Comment hidden (obsolete)
Comment 4 Mark Tompsett 2014-01-21 21:30:24 UTC
Silly default of enhancement! DOH!
Comment 5 Chris Cormack 2014-01-24 07:57:22 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2014-01-24 07:58:08 UTC Comment hidden (obsolete)
Comment 7 Jonathan Druart 2014-01-24 12:05:27 UTC
Created attachment 24676 [details] [review]
Bug 11587 - IsSuperLibrarian generates warnings (UT)

Simply viewing OPAC detail triggers a modulus warning entry.
This first patch adds two test cases to t/Context.t to test for
this situation.

TEST PLAN
---------
1) Apply this patch (to upgrade t/Context.t)
2) prove -v t/Context.t
-- Tests 7 and 8 will fail
3) Apply second patch (to amend C4/Context.pm)
4) prove -v t/Context.t
-- All tests will succeed

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 8 Jonathan Druart 2014-01-24 12:05:34 UTC
Created attachment 24677 [details] [review]
Bug 11587 - IsSuperLibrarian generates warnings

This corrects line 1250 of C4/Context.pm to be:
    return ($userenv->{flags}//0) % 2;
And thus avoids an uninitialized value used in the modulus.

TEST PLAN
---------
1) Apply the first patch (to update t/Context.t)
2) prove -v t/Context.t
-- This should fail tests 7 and 8
3) Apply this patch (to fix C4/Context.pm)
4) prove -v t/Context.t
-- All tests should succeed

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 9 Jonathan Druart 2014-01-24 12:05:42 UTC
Created attachment 24678 [details] [review]
Bug 11587 - Add UT for IsSuperLibrarian if flags == 0

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 10 Mark Tompsett 2014-03-06 07:22:57 UTC
*** Bug 11893 has been marked as a duplicate of this bug. ***
Comment 11 Galen Charlton 2014-03-10 16:06:56 UTC
Pushed to master.  Thanks, Mark!
Comment 12 Fridolin Somers 2014-08-07 08:06:55 UTC
Pushed to 3.14.x, will be in 3.14.10

I decided in the end to integrate Bug 10277 so also this one.