Bug 20923 - Merging backend status graph into main status graph incorrect use of grep
Summary: Merging backend status graph into main status graph incorrect use of grep
Status: RESOLVED DUPLICATE of bug 22280
Alias: None
Product: Koha
Classification: Unclassified
Component: ILL (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact:
URL:
Keywords:
Depends on: 20917
Blocks:
  Show dependency treegraph
 
Reported: 2018-06-12 16:17 UTC by Andrew Isherwood
Modified: 2022-11-07 10:40 UTC (History)
1 user (show)

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


Attachments
Bug 20923: Fix usage of grep (1.64 KB, patch)
2018-06-13 09:16 UTC, Andrew Isherwood
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Isherwood 2018-06-12 16:17:34 UTC
When the Illrequest object is being constructed, it consults the status graphs for enabled backends. These status graphs are then merged into the main graph in order to provide the full workflow for a request.

As part of this process, the "next_actions" property is updated to reflect any new statuses. During this, a check is performed to determine if the status graph knows about the next status being declared by a backend status graph:

if ( grep $prev_action, @core_status_ids ) {

This is incorrect. According to http://perldoc.perl.org/functions/grep.html, the first parameter should be a block or expression, here we are passing a string. This malfunctions in so much as passing "REQ" with match twice in the following array [ "REQ", "REQREV" ], this is not what we would expect.

The fix is to substitute the following line:

if ( grep /^$prev_action$/, @core_status_ids ) {
Comment 1 Andrew Isherwood 2018-06-13 09:16:19 UTC
Created attachment 76020 [details] [review]
Bug 20923: Fix usage of grep

This patch implements the fix described in the bug description. It is
impossible to test without the work that will be added to bug 20917.
Therefore a dependency will be added for that bug and a test plan will
be added here when that work is done.
Comment 2 Martin Renvoize 2019-09-23 15:38:26 UTC

*** This bug has been marked as a duplicate of bug 22280 ***