add-apt-repository does not handle malformed repo URL nicely

Bug #953424 reported by David Futcher
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

add-apt-repository doesn't handle URLs nicely when they are malformed in a particular way. If you forget to add a repository name to a full-form ppa url it should fail gracefully but instead crashes:

sudo add-apt-repository http://ppa.launchpad.net/username/ubuntu
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 95, in run
    self.add_ppa_signing_key(self.ppa_path)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 103, in add_ppa_signing_key
    owner_name, ppa_name, distro = ppa_path[1:].split('/')
ValueError: need more than 2 values to unpack

In this case I simply forgot to add the ppa name between the owner name and the distro. The 'correct' lines for the malformed URL are added to sources.list. It would be much nicer if add-apt-repository could handle this issue more gracefully. This is on Ubuntu 11.10, version 0.81.13.3.

Matt Fischer (mfisch)
Changed in software-properties (Ubuntu):
status: New → Confirmed
Revision history for this message
Olivier Tilloy (osomon) wrote :

This specific case appears to have been fixed a while ago. I couldn't find the specific commit, but running this test case in 20.04, an error is printed in the terminal, but no exception is raised.

Changed in software-properties (Ubuntu):
status: Confirmed → 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.