mysql, pgsql: Quote output filenames
authorintrigeri <intrigeri@boum.org>
Fri, 25 Dec 2009 01:33:13 +0000 (02:33 +0100)
committerintrigeri <intrigeri@boum.org>
Fri, 25 Dec 2009 01:33:13 +0000 (02:33 +0100)
... to support shell meta-characters in database names.
Closes Redmine bug #617.

ChangeLog
NEWS
handlers/mysql.in
handlers/pgsql.in

index 9a6ccaab955ae7afe240e6bc552c568130272540..97d435333070e721f27e131983e7d1a2984a6e1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -26,8 +26,12 @@ version 0.9.7 -- UNRELEASED
         . Fix the error message displayed when mysqld is not running:
           mysqladmin ping indeed returns 0 when authentication fails.
         . Use gzip's --rsyncable option.
         . Fix the error message displayed when mysqld is not running:
           mysqladmin ping indeed returns 0 when authentication fails.
         . Use gzip's --rsyncable option.
+        . Quote output filenames to support shell meta-characters in
+          database names.
        pgsql:
         . Use gzip's --rsyncable option.
        pgsql:
         . Use gzip's --rsyncable option.
+        . Quote output filenames to support shell meta-characters in
+          database names.
        sys:
         . New luksheaders option (default=disabled) to backup the Luks header
           of every Luks device.
        sys:
         . New luksheaders option (default=disabled) to backup the Luks header
           of every Luks device.
diff --git a/NEWS b/NEWS
index 361cf3c030ce3d31c9237daf1281a7dfb0d5061c..ef8592eedceb28ebb64af9f8963ea029994f4415 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+backupninja (0.9.7-1) UNRELEASED
+
+       * mysql: output filenames to support shell meta-characters in
+         database names. This change was not heavily tested, please
+         report any breakage.
+       * pgsql: output filenames to support shell meta-characters in
+         database names. This change was not heavily tested, please
+         report any breakage.
+
 backupninja (0.9.4-1) UNRELEASED
 
        * duplicity: Old (pre-0.9.4) example.dup file used to give false
 backupninja (0.9.4-1) UNRELEASED
 
        * duplicity: Old (pre-0.9.4) example.dup file used to give false
index e1e89b0a29ccff24d5c8b025f4ece10d0462a940..0aa3abbc9f4c5fb2d926d9f7ef41d5d6db8cdf6f 100644 (file)
@@ -272,9 +272,9 @@ then
             fatal "mysqld doesn't appear to be running!"
          fi
          if [ "$compress" == "yes" ]; then
             fatal "mysqld doesn't appear to be running!"
          fi
          if [ "$compress" == "yes" ]; then
-            execstr="$VSERVER $vsname exec $DUMP | $GZIP --rsyncable > $vroot$dumpdir/${db}.sql.gz"
+            execstr="$VSERVER $vsname exec $DUMP | $GZIP --rsyncable > '$vroot$dumpdir/${db}.sql.gz'"
          else
          else
-            execstr="$VSERVER $vsname exec $DUMP -r $vroot$dumpdir/${db}.sql"
+            execstr="$VSERVER $vsname exec $DUMP -r '$vroot$dumpdir/${db}.sql'"
          fi
       else
          # Test to make sure mysqld is running, if it is not sqldump will not work
          fi
       else
          # Test to make sure mysqld is running, if it is not sqldump will not work
@@ -283,9 +283,9 @@ then
             fatal "mysqld doesn't appear to be running!"
          fi
          if [ "$compress" == "yes" ]; then
             fatal "mysqld doesn't appear to be running!"
          fi
          if [ "$compress" == "yes" ]; then
-            execstr="$DUMP | $GZIP --rsyncable > $dumpdir/${db}.sql.gz"
+            execstr="$DUMP | $GZIP --rsyncable > '$dumpdir/${db}.sql.gz'"
          else
          else
-            execstr="$DUMP -r $dumpdir/${db}.sql"
+            execstr="$DUMP -r '$dumpdir/${db}.sql'"
          fi
       fi
       debug "su $user -c \"$execstr\""
          fi
       fi
       debug "su $user -c \"$execstr\""
index a7e3ec2b17338a92c1d8fdfed2987fec7cde5914..d7839fb53832bd68b505c615d3d5f31ff3a777bd 100644 (file)
@@ -75,15 +75,15 @@ chmod 700 $vroot$backupdir
 if [ "$databases" == "all" ]; then
    if [ $usevserver = yes ]; then
       if [ "$compress" == "yes" ]; then
 if [ "$databases" == "all" ]; then
    if [ $usevserver = yes ]; then
       if [ "$compress" == "yes" ]; then
-         execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > $backupdir/${vsname}.sql.gz\""
+         execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${vsname}.sql.gz'\""
       else
       else
-         execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${vsname}.sql\""
+         execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${vsname}.sql'\""
       fi
    else
       if [ "$compress" == "yes" ]; then
       fi
    else
       if [ "$compress" == "yes" ]; then
-         execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > $backupdir/${localhost}-all.sql.gz\""
+         execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL | $GZIP --rsyncable > '$backupdir/${localhost}-all.sql.gz'\""
       else
       else
-         execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > $backupdir/${localhost}-all.sql\""
+         execstr="su - $PGSQLUSER -c \"$PGSQLDUMPALL > '$backupdir/${localhost}-all.sql'\""
       fi
    fi
    debug "$execstr"
       fi
    fi
    debug "$execstr"
@@ -104,15 +104,15 @@ else
    for db in $databases; do
       if [ $usevserver = yes ]; then
          if [ "$compress" == "yes" ]; then
    for db in $databases; do
       if [ $usevserver = yes ]; then
          if [ "$compress" == "yes" ]; then
-            execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > $backupdir/${db}.sql.gz\""
+            execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
          else
          else
-            execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > $backupdir/${db}.sql\""
+            execstr="$VSERVER $vsname exec su - $PGSQLUSER -c \"$PGSQLDUMP $db | > '$backupdir/${db}.sql'\""
          fi
       else
          if [ "$compress" == "yes" ]; then
          fi
       else
          if [ "$compress" == "yes" ]; then
-            execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > $backupdir/${db}.sql.gz\""
+            execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db | $GZIP --rsyncable > '$backupdir/${db}.sql.gz'\""
          else
          else
-            execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > $backupdir/${db}.sql\""
+            execstr="su - $PGSQLUSER -c \"$PGSQLDUMP $db > '$backupdir/${db}.sql'\""
          fi
       fi
       debug "$execstr"
          fi
       fi
       debug "$execstr"