Bug 40006 - Upgrading install.pl shows code vs HTML
Summary: Upgrading install.pl shows code vs HTML
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (web-based installer) (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low minor
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-27 19:22 UTC by Shane Sammons
Modified: 2025-07-24 11:18 UTC (History)
3 users (show)

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


Attachments
Screen segment of Chrome browser showing code vs HTML output (30.82 KB, image/png)
2025-05-27 19:22 UTC, Shane Sammons
Details
Revised screen showing its the browser NOT source code (77.74 KB, image/png)
2025-05-28 12:04 UTC, Shane Sammons
Details
Images of Chrome's View Source (82.98 KB, image/png)
2025-05-28 12:06 UTC, Shane Sammons
Details
Bug 40006: Remove dbh->do return value from updatedatabase output (1.12 KB, patch)
2025-07-24 11:17 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 Shane Sammons 2025-05-27 19:22:25 UTC
Created attachment 182806 [details]
Screen segment of Chrome browser showing code vs HTML output

When upgrading from version 23 (sorry I did it by accident, so I didn't not the subversion) after entering the credentials from the .xml file and proceeding to update the database, install.pl shows code above the HTML code, and I believe this breaks the HTML structure, viewing the page source it looked the same as the page, less in Chrome it puts line numbers on the left.

Here is what appears about the HTML tags.
0E0
Status: 200 OK
Set-Cookie: CGISESSID=af07240f027e658abfa81c3155df289f; path=/; HttpOnly; SameSite=Lax
Date: Tue, 27 May 2025 19:03:47 GMT
Cache-control: no-cache
Content-script-type: text/javascript
Content-style-type: text/css
Pragma: no-cache
X-frame-options: SAMEORIGIN
Content-Type: text/html; charset=UTF-8
Comment 1 Jonathan Druart 2025-05-28 09:40:26 UTC
Looks ok for me.
Comment 2 Shane Sammons 2025-05-28 12:04:57 UTC
Created attachment 182814 [details]
Revised screen showing its the browser NOT source code

This is what I saw in the browser, it is code, not rendered HTML
Comment 3 Shane Sammons 2025-05-28 12:06:10 UTC
Created attachment 182815 [details]
Images of Chrome's View Source

Here it is rendered the exact same way with view source as the HTML page.
Comment 4 David Cook 2025-05-29 01:56:07 UTC
Hmm that's interesting. That suggests that two sets of HTTP headers were generated...  with a 0E0 in between them it seems...

It sounds like you have an atypical installation if you're getting to this screen. If you're not able to run the database update, you could just rollback the code anyway.
Comment 5 Jonathan Druart 2025-07-24 10:51:27 UTC
I have seen this 0E0 happening in the output of our test suite

https://jenkins.koha-community.org/job/Koha_Main/3317/consoleFull

twice:

00:49:06 koha_1       | Upgrade to 21.05.00.000  [22:48:57]: Koha 21.05.00 release
00:49:06 koha_1       | 0E0
00:49:06 koha_1       | Upgrade to 21.06.00.000  [22:48:57]: Increase DBRev for 21.06

00:49:12 koha_1       | Upgrade to 25.06.00.006  [22:49:06]: Bug 37883 - Add system preference FilterSearchResultsByLoggedInBranch
00:49:12 koha_1       | 	Added new system preference 'FilterSearchResultsByLoggedInBranch'
00:49:12 koha_1       | Running [koha-mysql kohadev -e 'UPDATE systempreferences SET value="21.1100000" WHERE variable="version"']...
00:49:12 koha_1       | Running [sudo koha-shell kohadev -p -c 'perl /kohadevbox/koha/installer/data/mysql/updatedatabase.pl']...
00:49:12 koha_1       | Use of uninitialized value $biblio_adds_authorities in string eq at /kohadevbox/koha/installer/data/mysql/db_revs/220600047.pl line 12.
00:49:12 koha_1       | Use of uninitialized value $pref in string eq at /kohadevbox/koha/installer/data/mysql/db_revs/231200005.pl line 89.
00:49:12 koha_1       | 0E0
00:49:12 koha_1       | Upgrade to 21.12.00.000  [22:49:07]: Increase DBRev for 21.12

May come from (to confirm):

installer/data/mysql/updatedatabase.pl

29463 unless ( $ENV{HTTP_HOST} ) {    # Is that correct?
29464     my $files  = get_db_entries;
29465     my $report = update( $files, { force => $force } );
29466 
29467     my $error_code = 0;
29468     for my $s ( @{ $report->{success} } ) {
29469         say Encode::encode_utf8( join "\n", @{ $s->{output} } );
29470     }
29471     for my $e ( @{ $report->{error} } ) {
29472         say Encode::encode_utf8( join "\n", @{ $e->{output} } );
29473         $error_code = 1;
29474     }
29475 
29476     my $atomic_update_files = get_atomic_updates;
29477     $report = run_atomic_updates($atomic_update_files);
29478     for my $s ( @{ $report->{success} } ) {
29479         say Encode::encode_utf8( join "\n", @{ $s->{output} } );
29480     }
29481     for my $e ( @{ $report->{error} } ) {
29482         say Encode::encode_utf8( join "\n", @{ $e->{output} } );
29483         $error_code = 1;
29484     }
29485     exit $error_code;
29486 }
Comment 6 Jonathan Druart 2025-07-24 11:17:55 UTC
Created attachment 184587 [details] [review]
Bug 40006: Remove dbh->do return value from updatedatabase output

There are 2 occurrences of "0E0" in the test suite output.

We should remove them.

Test plan:
root@kohadevbox:koha$ perl /kohadevbox/misc4dev/run_tests.pl --run-all-tests
And confirm that the 0E0 does no longer appear

You can abort when the update DB process is done