Backup of files with unnamed group id fails

Bug #1838702 reported by Stephan Müller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

I ran into this issue when I tried to backup files that have group ids which are not resolvable to group names.
The problem is, that when a file does not have a group name, the default is b''. In such a case, the function stn() fails because a bytes object does not have the encode function.

To fix this issue, the line "ti.gname = b''" in path.py must be replaced with "ti.gname = u''".

» ls -lh /tmp/test
total 4,0K
-rw-r--r-- 1 82 82 5 Aug 1 23:09 hallo

» duplicity full --no-encryption /tmp/test onedrive://backup/
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: Thu Aug 1 20:53:32 2019
Traceback (innermost last):
  File "/usr/local/bin/duplicity", line 1711, in <module>
    with_tempdir(main)
  File "/usr/local/bin/duplicity", line 1697, in with_tempdir
    fn()
  File "/usr/local/bin/duplicity", line 1543, in main
    do_backup(action)
  File "/usr/local/bin/duplicity", line 1667, in do_backup
    full_backup(col_stats)
  File "/usr/local/bin/duplicity", line 573, in full_backup
    globals.backend)
  File "/usr/local/bin/duplicity", line 432, in write_multivol
    at_end = gpg.GzipWriteFile(tarblock_iter, tdp.name, globals.volsize)
  File "/usr/local/lib/python3.7/site-packages/duplicity/gpg.py", line 454, in GzipWriteFile
    new_block = next(block_iter)
  File "/usr/local/lib/python3.7/site-packages/duplicity/diffdir.py", line 542, in __next__
    result = self.process(next(self.input_iter)) # pylint: disable=assignment-from-no-return
  File "/usr/local/lib/python3.7/site-packages/duplicity/diffdir.py", line 234, in get_delta_iter
    (new_path, sig_path, sigTarFile))
  File "/usr/local/lib/python3.7/site-packages/duplicity/robust.py", line 41, in check_common_error
    return function(*args)
  File "/usr/local/lib/python3.7/site-packages/duplicity/diffdir.py", line 159, in get_delta_path
    sigTarFile.addfile(ti)
  File "/usr/local/lib/python3.7/tarfile.py", line 1966, in addfile
    buf = tarinfo.tobuf(self.format, self.encoding, self.errors)
  File "/usr/local/lib/python3.7/tarfile.py", line 816, in tobuf
    return self.create_gnu_header(info, encoding, errors)
  File "/usr/local/lib/python3.7/tarfile.py", line 847, in create_gnu_header
    return buf + self._create_header(info, GNU_FORMAT, encoding, errors)
  File "/usr/local/lib/python3.7/tarfile.py", line 937, in _create_header
    stn(info.get("gname", ""), 32, encoding, errors),
  File "/usr/local/lib/python3.7/tarfile.py", line 161, in stn
    s = s.encode(encoding, errors)
 AttributeError: 'bytes' object has no attribute 'encode'

Environment:
duplicity 0.8.02
Python 3.7.3
Ubuntu 19.04

Changed in duplicity:
status: New → In Progress
assignee: nobody → Kenneth Loafman (kenneth-loafman)
importance: Undecided → Medium
milestone: none → 0.8.03
Changed in duplicity:
status: In Progress → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
assignee: Kenneth Loafman (kenneth-loafman) → nobody
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.