From 4fe259f19d32411f99fd124dfe8a4ee3a4676194 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 1 Sep 2023 09:10:52 +0200 Subject: [PATCH] Bug 34685: Make updatedatabase.pl propagate the error updatedatabase.pl already return 0 even if an error occurred during the upgrade. Test plan: Adjust a db rev to make it fail and modify the value of the syspref 'version' in DB to make the db rev run. Run updatedabase.pl and `echo $?` Signed-off-by: David Cook Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 531fb2c9fd2e8b38ac1c6ef21be047bbb0358d7a) Signed-off-by: Fridolin Somers (cherry picked from commit 706e1ed0925acc1a50816065594104deaba37b44) Signed-off-by: Matt Blenkinsop --- installer/data/mysql/updatedatabase.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 06f98e8e61..b8f2babbdd 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -24295,12 +24295,14 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct? my $files = get_db_entries; my $report = update( $files, { force => $force } ); + my $error_code = 0; for my $s ( @{ $report->{success} } ) { say Encode::encode_utf8(join "\n", @{$s->{output}}); } for my $e ( @{ $report->{error} } ) { say Encode::encode_utf8(join "\n", @{$e->{output}}); say Encode::encode_utf8("ERROR - " . $e->{error}); + $error_code = 1; } my $atomic_update_files = get_atomic_updates; @@ -24311,9 +24313,9 @@ unless ( $ENV{HTTP_HOST} ) { # Is that correct? for my $e ( @{ $report->{error} } ) { say Encode::encode_utf8(join "\n", @{$e->{output}}); say Encode::encode_utf8("ERROR - " . $e->{error}); + $error_code = 1; } - - + exit $error_code; } exit; -- 2.39.5