From 531fb2c9fd2e8b38ac1c6ef21be047bbb0358d7a 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 --- 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