UnicodeDecodeError on backup source dir change if either has non-ASCII

Bug #1758155 reported by Aaron Whitehouse
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Undecided
Aaron Whitehouse

Bug Description

Assume backups have been made from "original_source_dir" to "target_dir". If one then changes to backup a different folder, "new_source_dir" to the same "target_dir", duplicity will give a message like the following:
===
Fatal Error: Backup source directory has changed.
Current directory: new_source_dir
Previous directory: original_source_dir

Aborting because you may have accidentally tried to backup two different data sets to the same remote location, or using the same archive directory. If this is not a mistake, use the --allow-source-mismatch switch to avoid seeing this message
===

It appears that, if either the old or new source directories contains a non-ASCII character (e.g. the directory name "Имя"), duplicity will instead give the following error (this on trunk, though the equivalent is given on the 0.7-series):
Traceback (innermost last):
  File "[...]/bin/duplicity", line 1666, in <module>
    with_tempdir(main)
  File "[...]/bin/duplicity", line 1652, in with_tempdir
    fn()
  File "[...]/bin/duplicity", line 1499, in main
    do_backup(action)
  File "[...]/bin/duplicity", line 1633, in do_backup
    check_last_manifest(col_stats) # not needed for full backup
  File "[...]/bin/duplicity", line 1333, in check_last_manifest
    last_backup_set.check_manifests()
  File "[...]/duplicity/collections.py", line 230, in check_manifests
    remote_manifest.check_dirinfo()
  File "[...]/duplicity/manifest.py", line 101, in check_dirinfo
    "Previous directory: %s") % (globals.local_path.name, self.local_dirname) # @UndefinedVariable
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Changed in duplicity:
assignee: nobody → Aaron Whitehouse (aaron-whitehouse)
Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

The above error still occurs in 0.7.17.

In 0.8-series as at today (rev 1351), I get the error:

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 1380, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/home/aaron/coding/20190311_Bug_1758155/duplicity/commandline.py", line 1146, in ProcessCommandLine
    args = parse_cmdline_options(cmdline_list)
  File "/home/aaron/coding/20190311_Bug_1758155/duplicity/commandline.py", line 698, in parse_cmdline_options
    possible = [c for c in commands if c.startswith(cmd)]
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

Just tested on duplicity 0.8.13

==
$ duplicity Имя/ file://target_dir
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Fri Jun 12 20:56:04 2020
GnuPG passphrase:
Retype passphrase to confirm:
Fatal Error: Backup source directory has changed.
Current directory: b'\xd0\x98\xd0\xbc\xd1\x8f'
Previous directory: b'original_source_dir'

Aborting because you may have accidentally tried to backup two different data sets to the same remote location, or using the same archive directory. If this is not a mistake, use the --allow-source-mismatch switch to avoid seeing this message

==

So not pretty, but a lot better than a crash.

Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

I'm going to close this and open a low priority bug on Gitlab about making the output nicer.

Changed in duplicity:
status: New → Fix Released
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.