Bug 16678 - updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatterns.numberingmethod contains parentheses
Summary: updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatter...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (web-based installer) (show other bugs)
Version: master
Hardware: All All
: P3 major (vote)
Assignee: Jacek Ablewicz
QA Contact: Testopia
URL:
Keywords:
Depends on: 12375
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-07 07:56 UTC by Theodoros Theodoropoulos
Modified: 2019-06-27 09:24 UTC (History)
5 users (show)

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


Attachments
Bug 16678: updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatterns.numberingmethod contains parentheses (2.13 KB, patch)
2016-06-08 08:56 UTC, Jacek Ablewicz
Details | Diff | Splinter Review
Bug 16678: updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatterns.numberingmethod contains parentheses (2.18 KB, patch)
2016-06-08 10:43 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 16678: updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatterns.numberingmethod contains parentheses (2.31 KB, patch)
2016-06-08 14:07 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 Theodoros Theodoropoulos 2016-06-07 07:56:48 UTC
It seems that if subscription_numberpatterns.numberingmethod contains parentheses, updatedatabase.pl crashes when running the 3.23.00.006 DB upgrade snippet, with the following error:

[Mon Jun 6 09:06:54 2016] updatedatabase.pl: Unmatched ( in regex; marked by <-- HERE in m/ ( <-- HERE / at /home/koha/kohaclone/installer/data/mysql/updatedatabase.pl line 11498.

Steps to reproduce:
1/ Have a Koha DB version<3.23.00.006
2/ Create a subscription numbering with parentheses in it:
   ie "Vol. (Month, Year)" with pattern 
       Vol. {X} ({Y}, {Z})
3/ Add some serials using that numbering method so that serialseq is filled in DB:
   ie  "Vol. 16 (February, 2015)"
4/ Run the updatedatabase.pl script either from the cli or just start the webinstaller
5/ The error is produced


FYI, you can overcome this error if you go to the DB and remove parentheses from subscription_numberpatterns.numberingmethod as well as the relevant parentheses in the entries in serial.serialseq
Comment 1 Jacek Ablewicz 2016-06-08 08:34:42 UTC
Bug 8956 aka Bug 12375 was not backported to 3.22.x branch; looks like it's indeed an issue in 16.05 and master, but not in the 3.22?
Comment 2 Jacek Ablewicz 2016-06-08 08:56:06 UTC Comment hidden (obsolete)
Comment 3 Theodoros Theodoropoulos 2016-06-08 10:22:16 UTC
@Jacek although not a 'proper' test nor a 'signoff' (because I cannot easily degrade the DB version) I would like to share that I've applied your patch in the appropriate part of the updatedatabase.pl and run the code snippet for subscriptions that contained parentheses, and everything worked as expected!

Let's hope that someone else will manage to properly signoff your code so that it goes to QA and put to master (before anyone upgrading to 16.05 faces this issue)

Thanks!
Comment 4 Kyle M Hall 2016-06-08 10:43:32 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2016-06-08 14:07:53 UTC
Created attachment 52186 [details] [review]
Bug 16678: updatedatabase.pl 3.23.00.006 DB upgrade crashes if subscription_numberpatterns.numberingmethod contains parentheses

It seems that if subscription_numberpatterns.numberingmethod contains parentheses, updatedatabase.pl crashes when running the 3.23.00.006 DB upgrade snippet, with the following error:

[Mon Jun 6 09:06:54 2016] updatedatabase.pl: Unmatched ( in regex; marked by <-- HERE in m/ ( <-- HERE / at /home/koha/kohaclone/installer/data/mysql/updatedatabase.pl line 11498.

Steps to reproduce:
1/ Have a Koha DB version<3.23.00.006
2/ Create a subscription numbering with parentheses in it:
   ie "Vol. (Month, Year)" with pattern
       Vol. {X} ({Y}, {Z})
3/ Add some serials using that numbering method so that serialseq is filled in DB:
   ie  "Vol. 16 (February, 2015)"
4/ Run the updatedatabase.pl script either from the cli or just start the webinstaller
5/ The error is produced

To test:
1/ apply patch
2/ try to reproduce this issue once again, should be fixed now
3/ have a look at the code, make sure the changes are consistent

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Note: I have not tested the patch, but the diff looks good.
Comment 6 Kyle M Hall 2016-06-10 16:39:50 UTC
Pushed to master for 16.11, thanks Jacek!
Comment 7 Frédéric Demians 2016-06-15 07:41:06 UTC
Pushed in 16.05. Will be in 16.05.01.
Comment 8 Julian Maurice 2016-06-16 08:37:05 UTC
Not needed in 3.22.x