MEGA.nz backend issues after "conversion" to Python 3 (patch attached)

Bug #1876778 reported by José L. Domingo López on 2020-05-04
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Medium
Unassigned
duplicity (Ubuntu)
Undecided
Unassigned

Bug Description

Hello, despite I have never written anything in Python, it looks like the problem is some automatic code "conversion" to make this "duplicity" backend work with Python 3, or a similar issue, if the fundamental issue is another please ignore and stick to the facts below, thank you.

After upgrading from Ubuntu 18.04 LTS to 20.04 LTS, my "duplicity"-based backup to offsite MEGA.nz stopped working. This is what I was getting as a result (output shown for a fresh new test backup):
"""
export BACKUP_SOURCE="/tmp"
export BACKUP_DESTINATION="mega://<email address hidden>@mega.co.nz/Test_2"

# duplicity --full-if-older-than 30D ${BACKUP_SOURCE} ${BACKUP_DESTINATION}
mkdir: Test_2
megals: /Root/Test_2
Attempt 1 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Attempt 2 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Attempt 3 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Attempt 4 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Giving up after 5 attempts. TypeError: a bytes-like object is required, not 'str'
mkdir: Test_2
megals: /Root/Test_2
Attempt 1 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Attempt 2 failed. TypeError: a bytes-like object is required, not 'str'
megals: /Root/Test_2
Attempt 3 failed. TypeError: a bytes-like object is required, not 'str'
"""

After some research found out some calls to Python were being given a byte-like object instead of strings (str). So googled around and added some ".decode()" calls at some points in which strings were expected (some trial and error seeing all similar errors in the MEGA.nz backend data flow. After doing so, the backend resumed working normally (resulting patch against current "duplicity" package is attached). So please make a good patch from the one attached as reference and please make its way into the Ubuntu package ASAP (don't know if upstream version is affected as well).

More details about my current system:
"""
# lsb_release -rd
Description: Ubuntu 20.04 LTS
Release: 20.04

# apt-cache policy duplicity
duplicity:
  Instalados: 0.8.11.1612-1
  Candidato: 0.8.11.1612-1
  Tabla de versión:
 *** 0.8.11.1612-1 500
        500 http://es.archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status
"""

Hope you find this valuable.

The attachment "Tentative patch to fix current "duplicity" MEGA.nz backend issue with bytes / string objects" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.8.13
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
Changed in duplicity (Ubuntu):
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers