&2\nexit 2\n' > /tmp/fakebin/mysqldump chmod +x /tmp/fakebin/mysqldump (or set a wrong <pass> in koha-conf.xml)
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44190 Bug ID: 44190 Summary: koha-dump reports success and leaves an empty database dump when mysqldump fails Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: jake.deery@openfifth.co.uk, robin@catalyst.net.nz Target Milestone: --- debian/scripts/koha-dump pipes mysqldump into gzip: mysqldump $dbflag --host=... --user=... --password=... "$mysqldb" | gzip > "$dbdump" The script runs under set -e, but without pipefail the exit status of a pipeline is gzip's. When mysqldump fails (wrong password in koha-conf.xml, missing privilege, server down, disk full), gzip still succeeds, so koha-dump carries on, writes the configs tarball, prints "Done." and exits 0. The .sql.gz it leaves is about 20 bytes: an empty gzip stream. koha-run-backups and any cron or monitoring that checks the exit status therefore report a good backup every night while no database is being saved. Nobody finds out until a restore is needed. To reproduce (koha-testing-docker, main): 1. Make mysqldump fail. For example put a stand-in first on the PATH: mkdir /tmp/fakebin printf '#!/bin/sh\necho "mysqldump: Got error: 1045: Access denied" 2. PATH=/tmp/fakebin:$PATH koha-dump kohadev ; echo "exit=$?" 3. Output: the mysqldump error, then "* configs, logs to ...", "Done." and exit=0. 4. ls -l /var/spool/koha/kohadev/: the .sql.gz is 20 bytes. Expected: koha-dump stops with a non-zero exit status and says the database dump failed (and does not leave an empty .sql.gz that looks like a backup). The same applies to --schema-only (mysqldump | sed). Reproduced on main (6ff8078) and on Koha 26.05.02. Related but different: bug 41353 (the PROCESS privilege error itself). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.