Package: backupninja
Version: 1.0.1-1
Severity: normal

Dear Maintainer,

The duplicity backend is broken when the gpg ecryption is set up and the
system default locale is not english (or C).

The bug reports on duplicity are here :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=565398
https://bugs.launchpad.net/duplicity/+bug/510625

From a mail report :

> == fatal errors from /etc/backup.d/90.dup ==
> 
> Warning: Duplicity cleanup failed.
> Warning: Duplicity remove-older-than failed.
> Error: Les métadonnées locales et distantes sont déjà synchronisées. Aucune 
> synchronisation nécessaire.
> Error: Traceback (most recent call last):
> Error: File "/usr/bin/duplicity", line 1404, in <module>
> Error: with_tempdir(main)
> Error: File "/usr/bin/duplicity", line 1397, in with_tempdir
> Error: fn()
> Error: File "/usr/bin/duplicity", line 1277, in main
> Error: globals.archive_dir).set_values()
> Error: File "/usr/lib/python2.7/dist-packages/duplicity/collections.py", line 
> 691, in set_values
> Error: self.get_backup_chains(partials + backend_filename_list)
> Error: File "/usr/lib/python2.7/dist-packages/duplicity/collections.py", line 
> 814, in get_backup_chains
> Error: map(add_to_sets, filename_list)
> Error: File "/usr/lib/python2.7/dist-packages/duplicity/collections.py", line 
> 808, in add_to_sets
> Error: log.Debug(_("File %s is not part of a known set; creating new set") % 
> (filename,))
> Error: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 
> 23: ordinal not in range(128)
> Fatal: Duplicity failed.

I tried to run backupninja with a different locale with the appropriate
environment variable invocations but duplicity failed the same way.

Without further investigation, I tried to patch the duplicity handler to
prefix every invocations of duplicity with LC_ALL=C and it fixed the
problem.

You will find my patch attached to this bugreport.

-- System Information:
Debian Release: 7.3
  APT prefers stable
  APT policy: (910, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages backupninja depends on:
ii  bash               4.2+dfsg-0.1
ii  bsd-mailx [mailx]  8.1.2-0.20111106cvs-1
ii  dialog             1.1-20120215-2
ii  mawk               1.3.3-17

backupninja recommends no packages.

Versions of packages backupninja suggests:
pn  bzip2          <none>
ii  debconf-utils  1.5.49
ii  duplicity      0.6.18-3
pn  genisoimage    <none>
pn  hwinfo         <none>
pn  mdadm          <none>
pn  rdiff-backup   <none>
ii  rsync          3.0.9-4
ii  subversion     1.6.17dfsg-4+deb7u4
pn  trickle        <none>
pn  wodim          <none>

-- no debconf information
commit f4d8fa484baca111338fd12bf94995a48d745917
Author: Jonathan Dupart <jonat...@dupart.org>
Date:   Tue Jan 21 20:43:35 2014 +0100

    dup: prefix every call to duplicity with LC_ALL=C
    
    When used with gpg encryption and a non-C locale duplicity can fail on
    characters outside ascii set in gpg output.
    
    duplicity bug details are explained here :
    https://bugs.launchpad.net/duplicity/+bug/510625

diff --git a/handlers/dup.in b/handlers/dup.in
index a67848f..2634916 100644
--- a/handlers/dup.in
+++ b/handlers/dup.in
@@ -116,7 +116,7 @@ else
 fi
 
 ### duplicity version (ignore anything else than 0-9 and ".")
-duplicity_version="`duplicity --version | @AWK@ '{print $2}' | @SED@ 's/[^.[:digit:]]//g'`"
+duplicity_version="`LC_ALL=C duplicity --version | @AWK@ '{print $2}' | @SED@ 's/[^.[:digit:]]//g'`"
 duplicity_major="`echo $duplicity_version | @AWK@ -F '.' '{print $1}'`"
 duplicity_minor="`echo $duplicity_version | @AWK@ -F '.' '{print $2}'`"
 duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`"
@@ -281,13 +281,13 @@ fi
 ### Cleanup commands (duplicity >= 0.4.4)
 
 # cleanup
-debug "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart"
+debug "$execstr_precmd LC_ALL=C duplicity cleanup --force $execstr_options $execstr_serverpart"
 if [ ! $test ]; then
    export PASSPHRASE=$password
    export FTP_PASSWORD=$ftp_password
    output=`nice -n $nicelevel \
              su -c \
-             "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
+             "$execstr_precmd LC_ALL=C duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
    exit_code=$?
    if [ $exit_code -eq 0 ]; then
       debug $output
@@ -300,13 +300,13 @@ fi
 
 # remove-older-than
 if [ "$keep" != "yes" ]; then
-   debug "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
+   debug "$execstr_precmd LC_ALL=C duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
    if [ ! $test ]; then
       export PASSPHRASE=$password
       export FTP_PASSWORD=$ftp_password
       output=`nice -n $nicelevel \
                 su -c \
-                "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
+                "$execstr_precmd LC_ALL=C duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
       exit_code=$?
       if [ $exit_code -eq 0 ]; then
          debug $output
@@ -322,13 +322,13 @@ fi
 if [ "$keep" != "yes" ]; then
    if [ "$keepincroffulls" != "all" ]; then
       if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 10 ]; then
-         debug "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart"
+         debug "$execstr_precmd LC_ALL=C duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart"
          if [ ! $test ]; then
             export PASSPHRASE=$password
             export FTP_PASSWORD=$ftp_password
             output=`nice -n $nicelevel \
                su -c \
-               "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
+               "$execstr_precmd LC_ALL=C duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
             exit_code=$?
             if [ $exit_code -eq 0 ]; then
                debug $output
@@ -343,14 +343,14 @@ if [ "$keep" != "yes" ]; then
 fi
 
 ### Backup command
-debug "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
+debug "$execstr_precmd LC_ALL=C duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
 if [ ! $test ]; then
    outputfile=`maketemp backupout`
    export PASSPHRASE=$password
    export FTP_PASSWORD=$ftp_password
    output=`nice -n $nicelevel \
              su -c \
-                "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
+                "$execstr_precmd LC_ALL=C duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
    exit_code=$?
    debug $output
    cat $outputfile | (while read output ; do

Attachment: signature.asc
Description: Digital signature

Reply via email to