[Bug 1729754] Re: Python3 version of launchpadlib doesn't properly upload binary attachments to Launchpad
Pierre Equoy
pierre.equoy at canonical.com
Tue Jul 24 03:49:47 UTC 2018
I followed the same procedure as in the description, using the same
poc.py script.
Prereq:
- a xenial LXC container with -proposed packages enabled
- a bionic LXC container with -proposed packages enabled
Steps:
1. Connect to the Xenial container and install the following packages:
python-launchpadlib
python3-launchpadlib
python-wadllib/xenial-proposed
python3-wadllib/xenial-proposed
2. Make sure the poc.py is configured to use Python3, then:
a. attach a binary file:
$ APPORT_STAGING=1 ./poc.py <bug_number> <binary_file.tar.xz>
b. attach a text file:
$ APPORT_STAGING=1 ./poc.py <bug_number> <text_file.json>
→ In both cases, the file is attached properly. It can then be
downloaded and opened without problem.
3. Repeat step 2 using the poc.py in Python2 configuration
4. Repeat steps 1~3 using a Bionic container
→ In every cases, it worked out well for me. I attached a .tar.xz file,
a .jpg file (the one attached to this issue) as well as a .json file,
and in every cases I could download and open the file properly.
** Tags removed: verification-needed verification-needed-bionic verification-needed-xenial
** Tags added: verification-done verification-done-bionic verification-done-xenial
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-wadllib in Ubuntu.
https://bugs.launchpad.net/bugs/1729754
Title:
Python3 version of launchpadlib doesn't properly upload binary
attachments to Launchpad
Status in wadllib:
Fix Released
Status in python-wadllib package in Ubuntu:
Fix Released
Status in python-wadllib source package in Xenial:
Fix Committed
Status in python-wadllib source package in Bionic:
Fix Committed
Bug description:
Tested on 16.04 and 17.10
python-launchpadlib (1.10.5-1 on 17.10)
python3-launchpadlib (1.10.5-1 on 17.10)
While working on porting a utility using launchpadlib from Python2 to
Python3, I noticed the binary attachments were becoming unreadable.
I've tried uploading .jpg files, .tgz files, .tar.xz files, they all
fail to open properly.
P.S.: When a fix is available, can it be ported to Xenial? We need
this for our tools running on devices using Xenial.
[Test Case]
I wrote a little proof of concept that uploads a given binary attachment to a launchpad issue (see attachment). To use it on staging launchpad:
APPORT_STAGING=1 ./poc.py <bug_number> </path/to/file.bin>
When using the exact same script with python2 (basically, replacing
`python3` with `python` in the shebang line), the binary file is
properly attached. That's why I think it's a bug with
python3-launchpadlib.
[Regression Potential]
The only sensible way to fix this bug was to rewrite how wadllib does MIME-encoding of its form uploads, so it'll be important to test both text and binary uploads.
Launchpad only defines a few methods that use multipart/form-data, so
the regression potential is confined to those: bug.addAttachment,
distro_arch_series.setChroot, and project_release.add_file.
To manage notifications about this bug go to:
https://bugs.launchpad.net/wadllib/+bug/1729754/+subscriptions
More information about the foundations-bugs
mailing list