Package: duplicity
Version: 0.8.05-2
Severity: normal
Tags: patch upstream

Dear Maintainer,

The PCA (OVH public cloud archive) backend fails with Python 3, with "can only 
concatenate str (not "bytes") to str".

The attached patch, based on the most recent SWIFT backend, appears to work. 
However, I am not familiar with Python 3 so I would recommend checking it 
properly.

Cheers,
Bertrand

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), 
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages duplicity depends on:
ii  gnupg              2.2.17-3
ii  libc6              2.29-2
ii  librsync2          2.0.2-1
ii  python3            3.7.5-1
ii  python3-fasteners  0.14.1-2
ii  python3-future     0.16.0-1
ii  python3-lockfile   1:0.12.2-2

Versions of packages duplicity recommends:
ii  python3-oauthlib  2.1.0-2
ii  python3-paramiko  2.6.0-1
ii  python3-pexpect   4.6.0-1
ii  python3-urllib3   1.24.1-1
ii  rsync             3.1.3-8

Versions of packages duplicity suggests:
pn  lftp                 <none>
pn  ncftp                <none>
pn  par2                 <none>
pn  python3-boto         <none>
pn  python3-pip          <none>
ii  python3-swiftclient  1:3.8.1-2
pn  tahoe-lafs           <none>

-- no debconf information


--- /usr/lib/python3/dist-packages/duplicity/backends/pcabackend.py	2019-07-16 22:44:19.000000000 +0200
+++ /home/bbk/Temp/pcabackend.py	2019-11-07 18:02:17.513258254 +0100
@@ -150,8 +150,8 @@
                 return log.ErrorCode.backend_not_found
 
     def _put(self, source_path, remote_filename):
-        self.conn.put_object(self.container, self.prefix + remote_filename,
-                             file(source_path.name))
+        self.conn.put_object(self.container, self.prefix + util.fsdecode(remote_filename),
+                             open(util.fsdecode(source_path.name), u'rb'))
 
     def _get(self, remote_filename, local_path):
         body = self.preprocess_download(remote_filename, 60)
@@ -166,10 +166,10 @@
         return [o[u'name'][len(self.prefix):] for o in objs]
 
     def _delete(self, filename):
-        self.conn.delete_object(self.container, self.prefix + filename)
+        self.conn.delete_object(self.container, self.prefix + util.fsdecode(filename))
 
     def _query(self, filename):
-        sobject = self.conn.head_object(self.container, self.prefix + filename)
+        sobject = self.conn.head_object(self.container, self.prefix + util.fsdecode(filename))
         return {u'size': int(sobject[u'content-length'])}
 
     def preprocess_download(self, remote_filename, retry_period, wait=True):
@@ -188,7 +188,7 @@
 
     def unseal(self, remote_filename):
         try:
-            _, body = self.conn.get_object(self.container, self.prefix + remote_filename,
+            _, body = self.conn.get_object(self.container, self.prefix + util.fsdecode(remote_filename),
                                            resp_chunk_size=1024)
             log.Info(u"File %s was successfully unsealed." % remote_filename)
             return body

Reply via email to