Package: backupninja Version: 0.9.8.1-1 Severity: normal Tags: patch Yesterday I changed the root's default shell to /usr/bin/zsh and the mysql backup failed with this message:
== warnings from /etc/backup.d/20.mysql == Info: Initializing SQL dump method Warning: zsh:set:1: no such option: pipefail Warning: Failed to dump mysql databases information_schema Warning: zsh:set:1: no such option: pipefail Warning: Failed to dump mysql databases mysql After looking at the code I've seen that the problem is that on the mysql helper (and pgsql, btw) uses the `set -o pipefal` option on `su` calls, and that option does not work if the user invoked is not using /bin/bash as it's default shell (i've only tested with zsh, but I guess other shells does not have the option either). I'm attaching a tested patch against the `mysql` helper and an untested patch against the `pgsql` one (in this case I imagine that the issue is less important, as the user is usually dedicated to postgres, but the fix doesn't hurt anyway). -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores) Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages backupninja depends on: ii bash 4.1-3 The GNU Bourne Again SHell ii bsd-mailx [mailx] 8.1.2-0.20100314cvs-1 simple mail user agent ii dialog 1.1-20100428-1 Displays user-friendly dialog boxe ii gawk 1:3.1.7.dfsg-5 GNU awk, a pattern scanning and pr ii mawk 1.3.3-15 a pattern scanning and text proces backupninja recommends no packages. Versions of packages backupninja suggests: ii cdrdao 1:1.2.3-0.1 records CDs in Disk-At-Once (DAO) ii debconf-utils 1.5.36 debconf utilities ii dvd+rw-tools 7.1-7 DVD+-RW/R tools ii genisoimage 9:1.1.11-1 Creates ISO-9660 CD-ROM filesystem ii hwinfo 16.0-2 Hardware identification system pn mdadm <none> (no description available) ii rdiff-backup 1.2.8-6 remote incremental backup ii wodim 9:1.1.11-1 command line CD/DVD writing tool -- Configuration Files: /etc/backupninja.conf -- no debconf information -- Sergio Talens-Oliag <s...@debian.org> <http://people.debian.org/~sto/> Key fingerprint = 29DF 544F 1BD9 548C 8F15 86EF 6770 052B B8C1 FA69
--- /usr/share/backupninja/mysql.orig 2010-10-31 21:51:40.000000000 +0100 +++ /usr/share/backupninja/mysql 2010-11-04 10:35:20.614572913 +0100 @@ -303,7 +303,7 @@ debug "su $user -c \"$execstr\"" if [ ! $test ] then - output=`su $user -c "set -o pipefail ; $execstr" 2>&1` + output=`su $user -s /bin/bash -c "set -o pipefail ; $execstr" 2>&1` code=$? if [ "$code" == "0" ] then
--- /usr/share/backupninja/pgsql.orig 2010-10-31 21:51:40.000000000 +0100 +++ /usr/share/backupninja/pgsql 2010-11-04 10:50:37.138573634 +0100 @@ -75,13 +75,13 @@ if [ "$databases" == "all" ]; then if [ $usevserver = yes ]; then if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${vsname}.sql.gz'\"" else execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\"" fi else if [ "$compress" == "yes" ]; then - execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" + execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMPALL | $GZIP $GZIP_OPTS > '$backupdir/${localhost}-all.sql.gz'\"" else execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\"" fi @@ -104,13 +104,13 @@ for db in $databases; do if [ $usevserver = yes ]; then if [ "$compress" == "yes" ]; then - execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" + execstr="$VSERVER $vsname exec su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" else execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\"" fi else if [ "$compress" == "yes" ]; then - execstr="su - $PGSQLUSER -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" + execstr="su - $PGSQLUSER -s /bin/bash -c \"set -o pipefail ; $PGSQLDUMP $db | $GZIP $GZIP_OPTS > '$backupdir/${db}.sql.gz'\"" else execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\"" fi