Skip to content
Snippets Groups Projects
Commit f4ab3148 authored by intrigeri's avatar intrigeri
Browse files

mysql, pgsql: Quote output filenames

... to support shell meta-characters in database names.
Closes Redmine bug #617.
parent 5da707b3
No related branches found
No related tags found
No related merge requests found
...@@ -26,8 +26,12 @@ version 0.9.7 -- UNRELEASED ...@@ -26,8 +26,12 @@ version 0.9.7 -- UNRELEASED
. Fix the error message displayed when mysqld is not running: . Fix the error message displayed when mysqld is not running:
mysqladmin ping indeed returns 0 when authentication fails. mysqladmin ping indeed returns 0 when authentication fails.
. Use gzip's --rsyncable option. . Use gzip's --rsyncable option.
. Quote output filenames to support shell meta-characters in
database names.
pgsql: pgsql:
. Use gzip's --rsyncable option. . Use gzip's --rsyncable option.
. Quote output filenames to support shell meta-characters in
database names.
sys: sys:
. New luksheaders option (default=disabled) to backup the Luks header . New luksheaders option (default=disabled) to backup the Luks header
of every Luks device. of every Luks device.
......
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 backupninja (0.9.4-1) UNRELEASED
* duplicity: Old (pre-0.9.4) example.dup file used to give false * duplicity: Old (pre-0.9.4) example.dup file used to give false
......
...@@ -272,9 +272,9 @@ then ...@@ -272,9 +272,9 @@ then
fatal "mysqld doesn't appear to be running!" fatal "mysqld doesn't appear to be running!"
fi fi
if [ "$compress" == "yes" ]; then 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 fi
else else
# Test to make sure mysqld is running, if it is not sqldump will not work # Test to make sure mysqld is running, if it is not sqldump will not work
...@@ -283,9 +283,9 @@ then ...@@ -283,9 +283,9 @@ then
fatal "mysqld doesn't appear to be running!" fatal "mysqld doesn't appear to be running!"
fi fi
if [ "$compress" == "yes" ]; then 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
fi fi
debug "su $user -c \"$execstr\"" debug "su $user -c \"$execstr\""
......
...@@ -75,15 +75,15 @@ chmod 700 $vroot$backupdir ...@@ -75,15 +75,15 @@ chmod 700 $vroot$backupdir
if [ "$databases" == "all" ]; then if [ "$databases" == "all" ]; then
if [ $usevserver = yes ]; then if [ $usevserver = yes ]; then
if [ "$compress" == "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 fi
else else
if [ "$compress" == "yes" ]; then 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
fi fi
debug "$execstr" debug "$execstr"
...@@ -104,15 +104,15 @@ else ...@@ -104,15 +104,15 @@ else
for db in $databases; do for db in $databases; do
if [ $usevserver = yes ]; then if [ $usevserver = yes ]; then
if [ "$compress" == "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 fi
else else
if [ "$compress" == "yes" ]; then 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
fi fi
debug "$execstr" debug "$execstr"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment