Unicode exceptions issue

Bug #1386373 reported by Eugene Morozov
46
This bug affects 11 people
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

Duplicity fails to report correct exception when run in non-ascii locale. For example, if python-boto dependency is not installed and I attempt any operation involving interaction with Amazon S3, it fails with non-descriptive error:
Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1538, in <module>
    log.FatalError(u"%s: %s" % (e.__class__.__name__, util.uexc(e)),
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 76, in uexc
    return ufn(str(e))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)

This error can be easily fixed by replacing body of the uexc function in the utils module with the following statement:
return ufn(unicode(e).encode('utf-8'))

I'm using duplicity 0.6.23 (the code is the same in the latest version of duplicity) on Ubuntu 14.04.

Revision history for this message
mclovin (asdflea) wrote :

This doesn't work for me, unfortunately. I got the same error.

Changed in duplicity:
status: New → Incomplete
status: Incomplete → In Progress
importance: Undecided → Medium
assignee: nobody → Kenneth Loafman (kenneth-loafman)
milestone: none → 0.7.16
Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
status: In Progress → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
Paul Osbond (pa9l)
no longer affects: ubuntu
Revision history for this message
Raphaël Droz (raphael-droz) wrote :

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1546, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1540, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1391, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1510, in do_backup
    full_backup(col_stats)
  File "/usr/bin/duplicity", line 575, in full_backup
    globals.backend)
  File "/usr/bin/duplicity", line 456, in write_multivol
    (tdp, dest_filename, vol_num)))
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 146, in schedule_task
    return self.__run_synchronously(fn, params)
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 172, in __run_synchronously
    ret = fn(*params)
  File "/usr/bin/duplicity", line 455, in <lambda>
    vol_num: put(tdp, dest_filename, vol_num),
  File "/usr/bin/duplicity", line 344, in put
    backend.put(tdp, dest_filename)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 376, in inner_retry
    % exception_traceback())
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 52, in exception_traceback
    return uexc(msg)
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 80, in uexc
    e = unicode(e).encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 728: ordinal not in range(128)

Using
deja-dup 36.3-0ubuntu0.2
duplicity 0.7.12-1ubuntu1

same bug?

See also:
https://bugs.launchpad.net/duplicity/+bug/1758155
https://bugs.launchpad.net/duplicity/+bug/1736164

(will try duplicity 0.7.17 after my upgrade to 18.04)

Revision history for this message
BlueT - Matthew Lien - 練喆明 (bluet) wrote :

I'm still experiencing this bug.

Backup failed. I can't find any processing logs, so I'm not able to know which file caused the problem...

The dialog box shows:

Traceback (innermost last):
  File "/usr/bin/duplicity", line 1555, in <module>
    with_tempdir(main)
  File "/usr/bin/duplicity", line 1541, in with_tempdir
    fn()
  File "/usr/bin/duplicity", line 1393, in main
    do_backup(action)
  File "/usr/bin/duplicity", line 1511, in do_backup
    full_backup(col_stats)
  File "/usr/bin/duplicity", line 572, in full_backup
    globals.backend)
  File "/usr/bin/duplicity", line 454, in write_multivol
    (tdp, dest_filename, vol_num)))
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 146, in schedule_task
    return self.__run_synchronously(fn, params)
  File "/usr/lib/python2.7/dist-packages/duplicity/asyncscheduler.py", line 172, in __run_synchronously
    ret = fn(*params)
  File "/usr/bin/duplicity", line 453, in <lambda>
    vol_num: put(tdp, dest_filename, vol_num),
  File "/usr/bin/duplicity", line 342, in put
    backend.put(tdp, dest_filename)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 395, in inner_retry
    % (n, e.__class__.__name__, util.uexc(e)))
  File "/usr/lib/python2.7/dist-packages/duplicity/util.py", line 79, in uexc
    return ufn(unicode(e).encode('utf-8'))
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 27: ordinal not in range(128)

Environment:

bluet@ocisly:~/.cache/deja-dup$ dpkg-query -W deja-dup duplicity
deja-dup 37.1-2fakesync1ubuntu0.1
duplicity 0.7.17-0ubuntu1.1

bluet@ocisly:~/.cache/deja-dup$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
bluet@ocisly:~/.cache/deja-dup$ uname -a
Linux ocisly 5.3.0-61-generic #55~18.04.1-Ubuntu SMP Mon Jun 22 16:40:20 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

bluet@ocisly:~/.cache/deja-dup$ locale
LANG=zh_TW.UTF-8
LANGUAGE=zh_TW:en
LC_CTYPE="zh_TW.UTF-8"
LC_NUMERIC=zh_TW.UTF-8
LC_TIME=zh_TW.UTF-8
LC_COLLATE="zh_TW.UTF-8"
LC_MONETARY=zh_TW.UTF-8
LC_MESSAGES="zh_TW.UTF-8"
LC_PAPER=zh_TW.UTF-8
LC_NAME=zh_TW.UTF-8
LC_ADDRESS=zh_TW.UTF-8
LC_TELEPHONE=zh_TW.UTF-8
LC_MEASUREMENT=zh_TW.UTF-8
LC_IDENTIFICATION=zh_TW.UTF-8
LC_ALL=

https://answers.launchpad.net/deja-dup/+question/691652

Revision history for this message
Jan Klamta (5-jan-c) wrote :

Hello everyone,

there could by me more causes of this issue, but re-check and re-set the owner and rights of the backup folder helped me. Yes, this was caused by my own fault, but the deja-dup did not provide me with the "best" error message.

There are any details: https://askubuntu.com/questions/1248421/deja-dup-is-still-failing/1262326#1262326

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.