Package: backupninja
Version: 0.9.1-1
Severity: normal
Tags: patch

The track handler assumes the repository directories ($repo) are
immediate subdirectories of the source directory ($src) when it
executes mkdir to create the temporary directory.

In other words, a trac repository in /trac/foo works fine, but if the
repository is in /trac/foo/bar, trac-admin hotcopy fails because the
mkdir created $tmp instead of $tmp/foo .

The attached patch fixed the problem for me.  Also attached is a
before and after debug output.

--Brad

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldstable'), (500, 'unstable'), (500, 
'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12-20050918-686-skas3-v8.2
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages backupninja depends on:
ii  dialog                    1.0-20051107-1 Displays user-friendly dialog boxe
ii  gawk                      1:3.1.5-1      GNU awk, a pattern scanning and pr
ii  mawk                      1.3.3-11       a pattern scanning and text proces

backupninja recommends no packages.

-- no debconf information
--- /tmp/trac   2005-12-20 08:47:24.000000000 -0500
+++ /usr/share/backupninja/trac 2005-12-20 08:48:14.000000000 -0500
@@ -14,14 +14,15 @@
 do
     repo=`dirname $repo`
 
-    # Just make the $tmp dir, not $tmp/$repo
-    ret=`mkdir -p $tmp 2>&1`
+    # Just make the parent directory for $tmp/$repo
+    parentdir=`dirname $tmp/$repo`
+    ret=`mkdir -p $parentdir 2>&1`
     code=$?
     if [ "$ret" ]; then
        debug "$ret"
     fi
     if [ $code != 0 ]; then
-       error "command failed mkdir -p $tmp"
+       error "command failed mkdir -p $parentdir"
     fi
 
     ret=`trac-admin $src/$repo hotcopy $tmp/$repo 2>&1`
boxer:~# backupninja -d --run /etc/backup.d/40-boxer.trac 
Info: >>>> starting action /etc/backup.d/40-boxer.trac (because of --now)
Debug: yes
Debug: Command failed: [Errno 2] No such file or directory: 
'/backup/boxer/scheduled/trac.tmp.bun/./foo/bar'
Hotcopying /trac/foo/bar to /backup/boxer/scheduled/trac.tmp.bun/./foo/bar ...
Error: command failed -- trac-admin /trac/./foo/bar hotcopy 
/backup/boxer/scheduled/trac.tmp.bun/./foo/bar
Error: because of earlier errors, we are leaving trac backups in 
/backup/boxer/scheduled/trac.tmp.bun instead of /backup/boxer/scheduled/trac.bun
Error: <<<< finished action /etc/backup.d/40-boxer.trac: ERROR
Debug: send report to root
Info: FINISHED: 1 actions run. 0 fatal. 2 error. 0 warning.

boxer:~# patch /usr/share/backupninja/trac /tmp/trac.patch 
patching file /usr/share/backupninja/trac

boxer:~# backupninja -d --run /etc/backup.d/40-boxer.trac 
Info: >>>> starting action /etc/backup.d/40-boxer.trac (because of --now)
Debug: yes
Debug: Hotcopying /trac/foo/bar to 
/backup/boxer/scheduled/trac.tmp.bun/./foo/bar ... Hotcopy done.
Info: <<<< finished action /etc/backup.d/40-boxer.trac: SUCCESS
Debug: send report to root
Info: FINISHED: 1 actions run. 0 fatal. 0 error. 0 warning.



Reply via email to