From c14bab74aded27e3f4a3db8a12afac822862079c 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 $?` --- 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 06f98e8e614..f2708869ae1 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_occurred; 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_occurred++; } 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_occurred++; } - - + exit $error_occurred ? 1 : 0; } exit; -- 2.25.1