https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44190 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212182 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212182&action=edit Bug 44190: Stop koha-dump when mysqldump fails Bug 44190: Stop koha-dump when mysqldump fails koha-dump piped mysqldump into gzip (or sed for --schema-only). The exit status of a pipeline is the last command's, so set -e never saw a failed mysqldump: the script went on, printed "Done.", exited 0 and left an empty .sql.gz that looked like a backup. The script is /bin/sh, so instead of pipefail mysqldump writes its exit status to a temporary file; when it failed, koha-dump removes the empty dump, prints an error and exits 1. Test plan: 1. Make mysqldump fail, e.g. put a stand-in first on the PATH: mkdir /tmp/fakebin printf '#!/bin/sh\necho "mysqldump: Got error: 1045" >&2\nexit 2\n' > /tmp/fakebin/mysqldump chmod +x /tmp/fakebin/mysqldump 2. PATH=/tmp/fakebin:$PATH sh debian/scripts/koha-dump kohadev ; echo $? Without the patch: "Done.", 0, and a 20 byte .sql.gz in /var/spool/koha/kohadev. With the patch: "Error: mysqldump failed (exit status 2); no database dump was written.", 1, no .sql.gz. 3. Same with --schema-only: error and 1, no schema file. 4. sh debian/scripts/koha-dump kohadev (real mysqldump): "Done.", 0, and zcat of the .sql.gz ends with "-- Dump completed". Sponsored-by: Koha Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.