Description
Mark Tompsett
2015-04-15 16:38:38 UTC
Created attachment 37910 [details] [review] Bug 14001 - Inventory tool is not plack friendly After receiving an error while attempt a simple inventory run, Line 297 was changed from: ...$_->... to ...$item->... since the loop variable is $item. TEST PLAN --------- 1) Do what is described in comment #1 -- *kaboom* 2) apply the patch on the kohadevbox 3) re-attempt -- success! 4) run koha qa test tools Created attachment 37924 [details] [review] Bug 14001 - Inventory tool is not plack friendly After receiving an error while attempt a simple inventory run, Line 297 was changed from: ...$_->... to ...$item->... since the loop variable is $item. TEST PLAN --------- 1) installed the kohadevbox (https://github.com/digibib/kohadevbox) or have your staff client plackified 2) Log in to plack staff client 3) Add one item via z39.50, setting barcode to a known value (BARCODE1) 4) Wait for the reindex 5) Home -> Tools -> Inventory/Stocktaking 6) Browse for a file with the barcode in it 7) Set the library dropdown to the library branch of the added item. 8) Click 'Submit' -- *kaboom* Plack barfed on line 297. 9) Repeat steps 5-7 10) Check 'Compare barcodes list to results:' 11) Click 'Submit' -- *kaboom* Plack barfed on line 250. 12) apply the patch on the kohadevbox 13) re-attempt process (steps 5-11) -- success! 14) run koha qa test tools Mark, I don't manage to recreate the error. I would say the patch is correct, but there is certainly another issue, even without Plack: the $_ (l. ~297) equals {} and does not contain the item data. It would be good to highlight this problem in the test plan. Created attachment 39641 [details] [review] Bug 14001: [DO NOT PUSH TO MASTER] Proof that the $_ is wrong. TEST PLAN --------- 1) create new branch based on master 2) apply this patch 3) make sure you have the barcode of something in your inventory. or add it accordingly. 4) Create a dummy barcode file with that barcode. 5) Home -> Tools -> Inventory/stocktaking 6) Browse for that file 7) Click the 'Compare barcodes list to results:' checkbox. 8) Click the 'Submit' button. 9) Check the koha error log. -- Errors being looked for are like: [Thu May 28 12:14:53.454702 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.454737 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.454757 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-28, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455013 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455033 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455052 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455345 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455366 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455384 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455539 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455539 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455540 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.458994 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 325, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.459018 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION (MOD): , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.459037 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION (MOD): 2, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl As this should not be pushed to master, and is merely provided as evidence that there is a problem. Confirm that the two places correspond to the VERSION and VERSION (MOD) message locations. Created attachment 39642 [details] [review] Bug 14001 - Inventory has bad $_ references After receiving an error while attempt a simple inventory run, Two lines were changed from: ...$_->... to ...$item->... since the loop variable is $item. And $_ is not set to the expected hash reference, when there is a loop variable. This also helps explain the "Why are there blank dates on my last seen field?" problem that has been mentioned by users. TEST PLAN --------- 1) Log in to staff client 2) Add one item via z39.50, setting barcode to a known value (BARCODE1) 3) Wait for the reindex 4) Home -> Tools -> Inventory/Stocktaking 5) Browse for a file with the barcode in it 6) Set the library dropdown to the library branch of the added item. 7) Check 'Compare barcodes list to results:' 8) Click 'Submit' -- This should not die under plack. This should not generate blank last seen dates. The last seen dates should be as expected. 9) run koha qa test tools 10) Confirm the two change point correspond to the two change points in the patch which shall not be pushed to master. Created attachment 39643 [details] [review] Bug 14001 - Inventory has bad $_ references After receiving an error while attempt a simple inventory run, Two lines were changed from: ...$_->... to ...$item->... since the loop variable is $item. And $_ is not set to the expected hash reference, when there is a loop variable. This also helps explain the "Why are there blank dates on my last seen field?" problem that has been mentioned by users. TEST PLAN --------- 1) Apply this patch after a reset to master. 2) Log in to staff client 3) Add one item via z39.50, setting barcode to a known value (BARCODE1) 4) Wait for the reindex 5) Home -> Tools -> Inventory/Stocktaking 6) Browse for a file with the barcode in it 7) Set the library dropdown to the library branch of the added item. 8) Check 'Compare barcodes list to results:' 9) Click 'Submit' -- This should not die under plack. This should not generate blank last seen dates. The last seen dates should be as expected. 10) run koha qa test tools 11) Confirm the two change point correspond to the two change points in the patch which shall not be pushed to master. Created attachment 40117 [details] [review] Bug 14001: [DO NOT PUSH TO MASTER] Proof that the $_ is wrong. TEST PLAN --------- 1) create new branch based on master 2) apply this patch 3) make sure you have the barcode of something in your inventory. or add it accordingly. 4) Create a dummy barcode file with that barcode. 5) Home -> Tools -> Inventory/stocktaking 6) Browse for that file 7) Click the 'Compare barcodes list to results:' checkbox. 8) Click the 'Submit' button. 9) Check the koha error log. -- Errors being looked for are like: [Thu May 28 12:14:53.454702 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.454737 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.454757 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-28, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455013 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455033 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455052 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455345 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455366 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455384 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455539 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 278, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455539 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION: , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.455540 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION: 2015-05-25, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.458994 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: [Thu May 28 12:14:53 2015] inventory.pl: Use of uninitialized value in concatenation (.) or string at /home/mtompset/kohaclone/tools/inventory.pl line 325, <$fh> line 1., referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.459018 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $_ VERSION (MOD): , referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl [Thu May 28 12:14:53.459037 2015] [cgi:error] [pid 2428] [client 192.168.45.37:52408] AH01215: $item VERSION (MOD): 2, referer: http://library-admin.debiankoha.ca/cgi-bin/koha/tools/inventory.pl As this should not be pushed to master, and is merely provided as evidence that there is a problem. Confirm that the two places correspond to the VERSION and VERSION (MOD) message locations. The test patch proves the error condition Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com> Created attachment 40118 [details] [review] Bug 14001 - Inventory has bad $_ references After receiving an error while attempt a simple inventory run, Two lines were changed from: ...$_->... to ...$item->... since the loop variable is $item. And $_ is not set to the expected hash reference, when there is a loop variable. This also helps explain the "Why are there blank dates on my last seen field?" problem that has been mentioned by users. TEST PLAN --------- 1) Apply this patch after a reset to master. 2) Log in to staff client 3) Add one item via z39.50, setting barcode to a known value (BARCODE1) 4) Wait for the reindex 5) Home -> Tools -> Inventory/Stocktaking 6) Browse for a file with the barcode in it 7) Set the library dropdown to the library branch of the added item. 8) Check 'Compare barcodes list to results:' 9) Click 'Submit' -- This should not die under plack. This should not generate blank last seen dates. The last seen dates should be as expected. 10) run koha qa test tools 11) Confirm the two change point correspond to the two change points in the patch which shall not be pushed to master. The test result comply with expected outcome outlined in test plan. Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com> Created attachment 40164 [details] [review] Bug 14001 - Inventory has bad $_ references After receiving an error while attempt a simple inventory run, Two lines were changed from: ...$_->... to ...$item->... since the loop variable is $item. And $_ is not set to the expected hash reference, when there is a loop variable. This also helps explain the "Why are there blank dates on my last seen field?" problem that has been mentioned by users. TEST PLAN --------- 1) Apply this patch after a reset to master. 2) Log in to staff client 3) Add one item via z39.50, setting barcode to a known value (BARCODE1) 4) Wait for the reindex 5) Home -> Tools -> Inventory/Stocktaking 6) Browse for a file with the barcode in it 7) Set the library dropdown to the library branch of the added item. 8) Check 'Compare barcodes list to results:' 9) Click 'Submit' -- This should not die under plack. This should not generate blank last seen dates. The last seen dates should be as expected. 10) run koha qa test tools 11) Confirm the two change point correspond to the two change points in the patch which shall not be pushed to master. The test result comply with expected outcome outlined in test plan. Signed-off-by: Indranil Das Gupta (L2C2 Technologies) <indradg@gmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org> This fix should be backported to all supported versions (>=3.14) Patch pushed to master. Thanks Mark! As per Jonathan's comment #11, I confirmed the fix cleanly applies back to 3.14.x, and added candidate keywords. :) Pushed to 3.20.x will be in 3.20.2 *** Bug 12329 has been marked as a duplicate of this bug. *** Pushed to 3.16.x, will be in 3.16.13 |