Crash with UnicodeEncodeError

Bug #1603704 reported by Maciej Bliziński
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

When trying to run it:

maciej@quince:~$ duplicity /home/maciej/test-dir sftp://maciej@remote-host/
Traceback (most recent call last):
 File "/usr/bin/duplicity", line 1576, in <module>
   log.FatalError(u"%s: %s" % (e.__class__.__name__, util.uexc(e)),
 File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 83, in uexc
   return ufn(str(e))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe3' in position 1: ordinal not in range(128)

Here's a possible fix:

maciej@quince:~/src/duplicity$ bzr diff
=== modified file 'duplicity/util.py'
--- duplicity/util.py 2015-12-23 15:37:06 +0000
+++ duplicity/util.py 2016-07-16 22:40:01 +0000
@@ -77,6 +77,7 @@
     # non-ascii will cause a UnicodeDecodeError when implicitly decoding to
     # unicode. So we decode manually, using the filesystem encoding.
     # 99.99% of the time, this will be a fine encoding to use.
+ e = unicode(e).encode('utf-8')
     return ufn(str(e))

$ duplicity --version
duplicity 0.7.06

Revision history for this message
Governa (affqlixo) wrote :

The proposed solution works for me.

Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.7.12
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
Revision history for this message
Developer From Jokela (devfromjokela) wrote :

I get this error: UnicodeDecodeError: 'utf8' codec can't decode byte 0x90 in position 64: invalid start byte

Revision history for this message
Developer From Jokela (devfromjokela) wrote :

And here's stack trace:

Traceback (innermost last):
  File "/usr/bin/duplicity", line 1567, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1553, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1405, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1488, in do_backup
    list_current(col_stats)
  File "/usr/bin/duplicity", line 716, in list_current
    for path in path_iter:
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 354, in combine_path_iters
    refresh_triple_list(triple_list)
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 341, in refresh_triple_list
    new_triple = get_triple(old_triple[1])
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 327, in get_triple
    path = path_iter_list[iter_index].next()
  File "/usr/lib/python2.7/dist-packages/duplicity/diffdir.py", line 239, in sigtar2path_iter
    for tarinfo in tf:
  File "/usr/lib/python2.7/tarfile.py", line 2510, in next
    tarinfo = self.tarfile.next()
  File "/usr/lib/python2.7/tarfile.py", line 2358, in next
    tarinfo = self.tarinfo.fromtarfile(self)
  File "/usr/lib/python2.7/tarfile.py", line 1254, in fromtarfile
    return obj._proc_member(tarfile)
  File "/usr/lib/python2.7/tarfile.py", line 1276, in _proc_member
    return self._proc_pax(tarfile)
  File "/usr/lib/python2.7/tarfile.py", line 1406, in _proc_pax
    value = value.decode("utf8")
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
 UnicodeDecodeError: 'utf8' codec can't decode byte 0x90 in position 64: invalid start byte

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Please upgrade to the current version of duplicity. This will assure that any bugs fixed since your release are available and may fix your issue.

There are multiple options both stable and daily:

* Source - https://gitlab.com/duplicity/duplicity
* Stable tarball install - https://launchpad.net/duplicity/+download
* Daily duplicity PPA - https://code.launchpad.net/~duplicity-team/+archive/ubuntu/duplicity-develop-git
* Stable duplicity PPA - https://code.launchpad.net/~duplicity-team/+archive/ubuntu/duplicity-release-git
* Stable snap builds - “sudo snap install duplicity —classic"
* Latest snap builds - “sudo snap install duplicity —classic —edge"
* Latest pip3 builds - “sudo pip3 install duplicity"

Note 1: UNINSTALL duplicity first if it was installed from a different source.. This is due to divergent install locations, especially between repository installs and the other forms.

Note 2: Launchpad PPAs contain builds for Bionic 18.04, Eoan 19.10, and Focal 20.04. Xenial 16.04 works with Snap and Pip installs, but cannot be built under Launchpad PPAs at the moment.

Revision history for this message
Developer From Jokela (devfromjokela) wrote :

Ok. Thanks, I'll upgrade and report back.

Revision history for this message
Developer From Jokela (devfromjokela) wrote :

Hello,

I've updated, and it works now on latest Daily duplicity PPA install.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.