﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
673	mondoarchive doesn't handle files with quote	Bruno Cornec	Bruno Cornec	"I am using Mondo Rescue 3.0.2-1 on Ubuntu 12.04.2 LTS at home, in order to backup my own home computer. I am running mondoarchive
through a wrapper started with cron, thanks to which I am running full or differential backups, depending on the week day, I am saving some previous backups as history, though managing the disk space in order to avoid a filesystem full.

Looking closely to my cron logs (received by email), I noticed, every day, the following error, which obviously was not critical :

{{{
/usr/sbin/mondoarchive -Oi -D -d /backup_power4/201307 -p power4-differential-20130217 -E
'/stor_ext|/backup_power4|/Movies_home|/stor_ext2|/backup_rubedo|/dev/sr0' -N -s 20g -L -V
sh: 1: Syntax error: Unterminated quoted string
Initializing...
}}}

so eventually I ran an accurate diagnostic : I started my wrapper though strace :
{{{
strace -s 400 -f -ff -o backup_strace ./backup_power4_mondoarchive
}}}
and found something interesting : I actually have a long directory
name, generated by Firefox as I was saving some web page :
{{{
rtmp:_ retrieval with rtmpdump and tcpdump « Pxnh's Blog_files
}}}
at some point, mondoarchive tries some grep -Fv operation :
{{{
execve(""/bin/sh"", [""sh"", ""-c"", ""grep -Fv '/home/robert/rtmp:_retrieval with rtmpdump and tcpdump \302\253 Pxnh\\'s Blog_files'
/backup_power4/mondo.tmp.9Wl2n9/tmpfs/skeleton.txt >
/backup_power4/mondo.tmp.9Wl2n9/tmpfs/skeleton.txt.new 2> /dev/null""],
[/* 22 vars */]) = 0
brk(0)
}}}
this process ends with
{{{
write(2, ""Syntax error: Unterminated quoted string"", 40) = 40
}}}
well, if I try this grep from the command-line, it is clearly unfinished :
{{{
root@power4:~/tmp# grep -FV '/home/robert/rtmp:_ retrieval with
rtmpdump and tcpdump \302\253 Pxnh\\'s Blog_files' skeleton.txt
}}}
actually the right syntax is :
{{{
grep -Fv '/home/robert/rtmp:_ retrieval with rtmpdump and tcpdump
\302\253 Pxnh'\''s Blog_files' skeleton.txt

root@power4:~/tmp# grep -Fv '/home/robert/rtmp:_ retrieval with
rtmpdump and tcpdump \302\253 Pxnh'\''s Blog_files' skeleton.txt |head
/
/lib
/lib/libnfsidmap
/lib/oss-compat
/lib/security
/lib/udev
/lib/udev/rules.d
/lib/udev/devices
/lib/udev/keymaps
/lib/apparmor
}}}
You may have a little bug here ?

launcher script:
{{{
#!/bin/bash
set -x

# RG - 24 déc 2008
# révisé le 10  février 2013
# inspiré du script homologue au Leg

# principe :
# je m'assure que je peux stocker 250 GB + 20 GB de marge (au hasard)
cd /backup_power4

cur_home_size=`df -B 1 /backup_power4|awk '/\/dev\/sda2/ {print $4}'`

while [[ $cur_home_size -lt $(( 290000000000 )) ]]
do
   lastdir=`ls -1 -d 20* | head -1`
   /bin/rm -fr $lastdir
   cur_home_size=`df -B 1 /backup_power4|awk '/\/dev\/sda2/ {print $4}'`
done

[ -d /backup_power4/`date +'%Y%U'` ] || mkdir /backup_power4/`date +'%Y%U'`
if [ ""`date +%a`"" = ""Mon"" ]
then
   # performing a full backup
   #mondoarchive -Oi -d /backup_power4/`date +'%Y%U'` -p ""power4-full-`date +'%Y%m%d'`"" -E
""/stor_ext|/backup_power4|/Movies_home|/stor_ext2|/backup_rubedo|/dev/sr0"" -N -s 20g -L -g -V
   /usr/sbin/mondoarchive -Oi -d /backup_power4/`date +'%Y%U'` -p ""power4-full-`date +'%Y%m%d'`"" -E
'/stor_ext|/backup_power4|/Movies_home|/stor_ext2|/backup_rubedo|/dev/sr0' -N -s 20g -L  -V
else
   # performing a differential backup
   #mondoarchive -Oi -D -d /backup_power4/`date +'%Y%U'` -p ""power4-differential-`date +'%Y%m%d'`"" -E
""/stor_ext|/backup_power4|/Movies_home|/stor_ext2|/backup_rubedo|/dev/sr0"" -N -s 20g -L -g -V
   /usr/sbin/mondoarchive -Oi -D -d /backup_power4/`date +'%Y%U'` -p ""power4-differential-`date +'%Y%m%d'`"" -E
'/stor_ext|/backup_power4|/Movies_home|/stor_ext2|/backup_rubedo|/dev/sr0' -N -s 20g -L  -V
fi
cp /var/cache/mindi/mondorescue.iso /backup_power4/`date +'%Y%U'`
}}}

strace reslt!
{{{
rt_sigaction(SIGINT, {0x434800, [INT], SA_RESTORER|SA_RESTART, 0x7f06f9d484a0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, [], SA_RESTORER, 0x7f06f9d484a0}, NULL, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
execve(""/bin/sh"", [""sh"", ""-c"", ""grep -Fv '/home/robert/rtmp:_ retrieval with rtmpdump and tcpdump \302\253 Pxnh\\'s Blog_files'
/backup_power4/mondo.tmp.iLmTen/tmpfs/skeleton.txt > /backup_power4/mondo.tmp.iLmTen/tmpfs/skeleton.txt.new 2> /dev/null""], [/* 22 vars */]) =
0
brk(0)                                  = 0x24aa000
access(""/etc/ld.so.nohwcap"", F_OK)      = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcc749d5000
access(""/etc/ld.so.preload"", R_OK)      = -1 ENOENT (No such file or directory)
open(""/etc/ld.so.cache"", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=159105, ...}) = 0
mmap(NULL, 159105, PROT_READ, MAP_PRIVATE, 4, 0) = 0x7fcc749ae000
close(4)                                = 0
access(""/etc/ld.so.nohwcap"", F_OK)      = -1 ENOENT (No such file or directory)
open(""/lib/x86_64-linux-gnu/libc.so.6"", O_RDONLY|O_CLOEXEC) = 4
read(4,
""\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\200\30\2\0\0\0\0\0@\0\0\0\0\0\0\0\370\231\33\0\0\0\0\0\0\0\0\0@\0008\0\n\0@\0#\0\""\0\6\0\0\0\5\
0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0000\2\0\0\0\0\0\0000\2\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\320C\30\0\0\0\0\0\320C\30
\0\0\0\0\0\320C\30\0\0\0\0\0\34\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\20\0\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0
\34@\33\0\0\0\0\0\34@\33\0\0\0\0\0\0\0
\0\0\0\0\0\1\0\0\0\6\0\0\0\0G\33\0\0\0\0\0\0G;\0\0\0\0\0\0G;\0\0\0\0\0`Q\0\0\0\0\0\0\330\235\0\0\0\0\0\0\0\0
\0\0\0\0\0\2\0\0\0\6\0\0\0@{\33\0\0\0\0\0@{;\0\0\0\0\0@{;\0\0\0\0\0\340\1\0\0\0\0\0\0\340\1\0\0\0\0\0\0\10\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0p\2\0\0
\0\0\0\0p\2\0\0\0\0\0\0p\2\0\0\0\0\0\0D\0\0\0\0\0\0\0D\0\0\0\0\0\0\0\4\0\0\0\0\0\0\0""..., 832) = 832
fstat(4, {st_mode=S_IFREG|0755, st_size=1811128, ...}) = 0
mmap(NULL, 3925208, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0x7fcc743f6000
mprotect(0x7fcc745ab000, 2093056, PROT_NONE) = 0
mmap(0x7fcc747aa000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1b4000) = 0x7fcc747aa000
mmap(0x7fcc747b0000, 17624, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fcc747b0000
close(4)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcc749ad000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcc749ac000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fcc749ab000
arch_prctl(ARCH_SET_FS, 0x7fcc749ac700) = 0
mprotect(0x7fcc747aa000, 16384, PROT_READ) = 0
mprotect(0x619000, 4096, PROT_READ)     = 0
mprotect(0x7fcc749d7000, 4096, PROT_READ) = 0
munmap(0x7fcc749ae000, 159105)          = 0
getpid()                                = 3648
rt_sigaction(SIGCHLD, {0x40f100, ~[RTMIN RT_1], SA_RESTORER, 0x7fcc7442c4a0}, NULL, 8) = 0
geteuid()                               = 0
brk(0)                                  = 0x24aa000
brk(0x24cb000)                          = 0x24cb000
getppid()                               = 32558
stat(""/backup_power4"", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat(""."", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=4096, ...}) = 0
getcwd(""/tmp"", 4096)                    = 5
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x40f100, ~[RTMIN RT_1], SA_RESTORER, 0x7fcc7442c4a0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fcc7442c4a0}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], SA_RESTORER, 0x7fcc7442c4a0}, NULL, 8) = 0
write(2, ""sh: 1: "", 7)                  = 7
write(2, ""Syntax error: Unterminated quoted string"", 40) = 40
write(2, ""\n"", 1)                       = 1
exit_group(2)                           = ?
}}}"	defect	closed	normal	3.0.4	mondo	3.0.3	normal	fixed		
