Bug 31855

Summary: Installer output buffering can be confusing
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Installation and upgrade (command-line installer)Assignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, kyle, m.de.rooy, martin.renvoize
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14783
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Tomás Cohen Arazi (tcohen) 2022-10-18 12:27:10 UTC
On bug 14783 a bug was introduced on the db_rev, that cleared all sysprefs.

I rewinded ~500 commits in an attempt to reproduce it, following this steps:

$ git reset --hard 1a1529d20572c8eb7e65ad7bbd41f688d5f86f07
$ reset_all
$ git reset --hard ae986b992dfc2299ec58f4d1c0079fbac1ec4a03
$ updatedatabase

the result is:

root@kohadevbox:koha(master)$ updatedatabase 
C4::Installer::SetVersion(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry 'Version' for key 'PRIMARY' at /kohadevbox/koha/C4/Installer.pm line 777

If I do this:

$ git reset --hard 1a1529d20572c8eb7e65ad7bbd41f688d5f86f07
$ reset_all
$ git reset --hard ab1e0a5d6ad2eb31e4322ec11a1e971386144f5d
$ updatedatabase

the result is:

root@kohadevbox:koha((1a1529d2057...))$ updatedatabase 
Upgrade to 22.06.00.045  [12:04:08]: Bug 29144 - Copy and remove branches.opac_info
Upgrade to 22.06.00.046  [12:04:08]: Bug 15348 - Add new column aqorders.estimated_delivery_date
Upgrade to 22.06.00.047  [12:04:08]: Bug 30025 - Split and rename BiblioAddsAuthorities system preference
	Added RequireChoosingExistingAuthority and AutoLinkBiblios
	BiblioAddsAuthorities removed
Upgrade to 22.06.00.048  [12:04:08]: Bug 30472 - borrower_relationships.guarantor_id NOT NULL
Upgrade to 22.06.00.049  [12:04:08]: Bug 30490 - Adjust FK constraint for parent item type
Upgrade to 22.06.00.050  [12:04:08]: Bug 30497 - Recreate old_reserves_ibfk_4 if cascading
Upgrade to 22.06.00.051  [12:04:08]: Bug  7021 - Add patron category to the statistics table
Upgrade to 22.06.00.052  [12:04:08]: Bug 25735 - Add Elasticsearch field 'available'
Upgrade to 22.06.00.053  [12:04:08]: Bug 30484 - Add a notice template for ILL Update notices
	Bug 30484 DB update complete
Upgrade to 22.06.00.054  [12:04:08]: Bug 23538 - Add new system preferences EmailPatronRegistrations and EmailAddressForPatronRegistrations and new OPAC_REG letter
Upgrade to 22.06.00.055  [12:04:08]: Bug 26368 - Add OCLC Encoding Levels system preference
	Added UseOCLCEncodingLevels system preference
Upgrade to 22.06.00.056  [12:04:08]: Bug 30571 - Table z3950servers: three cols NOT NULL
Upgrade to 22.06.00.057  [12:04:08]: Bug 29071 - Set HoldsQueueSplitNumbering where not set
	Added HoldsSplitQueueNumbering if not already there
Upgrade to 22.06.00.058  [12:04:08]: Bug 30944 - Replace branchtransfers.cancellation_reason CancelRecall with RecallCancellation
Upgrade to 22.06.00.059  [12:04:08]: Bug 25936 - A password change notification feature
Upgrade to 22.06.00.060  [12:04:08]: Bug 10950 - Add pronouns to borrowers table
	Added pronouns column to borrowers table
	Added pronouns column to deletedborrowers table
	Added pronouns column to borrower_modifications table
Upgrade to 22.06.00.061  [12:04:08]: Bug 31333 - Add new suggestionPatronCategoryExceptions system preference
Upgrade to 22.06.00.062  [12:04:08]: Bug 27136 - Add missing languages: Cree, Afrikaans and Multiple languages, Undetermined and No linguistic content
	Added missing languages
Upgrade to 22.06.00.063  [12:04:08]: Bug 31569 - Add primary key for import_biblios
	Added primary key to import_biblios table
Upgrade to 22.06.00.064  [12:04:08]: Bug 14783 - Allow patrons to change pickup location for non-waiting holds
	Added new system preference 'OPACAllowUserToChangeBranch'
	Removed system preference 'OPACInTransitHoldPickupLocationChange'

As the 'failing' db_rev is the last one, I would've expected the upgrade process to print the previous db_revs output and fail on the last one, somehow.

It is a weird case (the introduced bug cleared all sysprefs) but yet, the output is not correct.