Package: duplicity
Version: 0.8.05-2
Severity: important
Tags: patch

Dear Maintainer,

Today I tried to restore directory from a backup with deja-dup. The restoration
always failed with the following traceback:

Traceback (innermost last):
  File "/usr/bin/duplicity", line 107, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 93, in with_tempdir
    fn()
  File "/usr/lib/python3/dist-packages/duplicity/dup_main.py", line 1521, in
main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1216, in
ProcessCommandLine
    backup, local_pathname = set_backend(args[0], args[1])
  File "/usr/lib/python3/dist-packages/duplicity/commandline.py", line 1087, in
set_backend
    globals.backend = backend.get_backend(bend)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 225, in
get_backend
    obj = get_backend_object(url_string)
  File "/usr/lib/python3/dist-packages/duplicity/backend.py", line 211, in
get_backend_object
    return factory(pu)
  File "/usr/lib/python3/dist-packages/duplicity/backends/giobackend.py", line
81, in __init__
    ensure_dbus()
  File "/usr/lib/python3/dist-packages/duplicity/backends/giobackend.py", line
37, in ensure_dbus
    lines = output.split(u'\n')
 TypeError: a bytes-like object is required, not 'str'

The folder in question is on a secondary, ntfs drive. If I try to restore a
file on the main drive,
no error happens. This is probably because deja-dup does not use the gio
backend in this case.

The following patch fixes the problem for me:

--- /tmp/foo.py 2019-11-09 22:52:50.535057865 +0100
+++ /usr/lib/python3/dist-packages/duplicity/backends/giobackend.py
2019-11-09 22:53:22.780500816 +0100
@@ -33,7 +33,7 @@
     # when required.  So we make sure that such a bus exists and that our
     # environment points to it.
     if u'DBUS_SESSION_BUS_ADDRESS' not in os.environ:
-        output = subprocess.Popen([u'dbus-launch'],
stdout=subprocess.PIPE).communicate()[0]
+        output = subprocess.Popen([u'dbus-launch'],
stdout=subprocess.PIPE).communicate()[0].decode("utf8", errors="replace")
         lines = output.split(u'\n')
         for line in lines:
             parts = line.split(u'=', 1)




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

Kernel: Linux 5.2.0-3-amd64 (SMP w/2 CPU cores)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
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 /bin/bash
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.3-1
ii  python3-fasteners  0.12.0-5
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-1
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-6+b1

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

-- no debconf information
--- /tmp/foo.py 2019-11-09 22:52:50.535057865 +0100
+++ /usr/lib/python3/dist-packages/duplicity/backends/giobackend.py     
2019-11-09 22:53:22.780500816 +0100
@@ -33,7 +33,7 @@
     # when required.  So we make sure that such a bus exists and that our
     # environment points to it.
     if u'DBUS_SESSION_BUS_ADDRESS' not in os.environ:
-        output = subprocess.Popen([u'dbus-launch'], 
stdout=subprocess.PIPE).communicate()[0]
+        output = subprocess.Popen([u'dbus-launch'], 
stdout=subprocess.PIPE).communicate()[0].decode("utf8", errors="replace")
         lines = output.split(u'\n')
         for line in lines:
             parts = line.split(u'=', 1)
--- /tmp/foo.py 2019-11-09 22:52:50.535057865 +0100
+++ /usr/lib/python3/dist-packages/duplicity/backends/giobackend.py     
2019-11-09 22:53:22.780500816 +0100
@@ -33,7 +33,7 @@
     # when required.  So we make sure that such a bus exists and that our
     # environment points to it.
     if u'DBUS_SESSION_BUS_ADDRESS' not in os.environ:
-        output = subprocess.Popen([u'dbus-launch'], 
stdout=subprocess.PIPE).communicate()[0]
+        output = subprocess.Popen([u'dbus-launch'], 
stdout=subprocess.PIPE).communicate()[0].decode("utf8", errors="replace")
         lines = output.split(u'\n')
         for line in lines:
             parts = line.split(u'=', 1)

Reply via email to