Providing wrong ppa format in add-apt-repository throws a 404 error which is not handled appropriately

Bug #887249 reported by Manish Sinha (मनीष सिन्हा) on 2011-11-07
506
This bug affects 68 people
Affects Status Importance Assigned to Milestone
Software Properties
Fix Committed
Undecided
Manish Sinha (मनीष सिन्हा)
software-properties (Ubuntu)
Undecided
Unassigned

Bug Description

I was trying to add the elementary PPA, but by mistake added a ~ after :

$ sudo add-apt-repository ppa:~elementaryart/elementarydesktop
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 88, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 65, in get_ppa_info_from_lp
    lp_page = urlopen(req).read()
  File "/usr/lib/python2.7/urllib2.py", line 126, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 404: Not Found

Expected: The exception should be handled and a friendly error message should be shown instead of a verbose exception

---------

$ lsb_release -rd
Description: Ubuntu 11.10
Release: 11.10

--------

$ apt-cache policy python-software-properties
python-software-properties:
  Installed: 0.81.13.1
  Candidate: 0.81.13.1

--------

summary: Providing wrong ppa format in add-apt-repository throws a 404 error
- which is not caught
+ which is not handled appropiately
summary: Providing wrong ppa format in add-apt-repository throws a 404 error
- which is not handled appropiately
+ which is not handled appropriately
description: updated
Changed in software-properties:
assignee: nobody → Manish Sinha (मनीष सिन्हा) (manishsinha)
status: New → In Progress
Sam_ (and-sam) wrote :

They seem to be linked. Bug #782120

summary: - Providing wrong ppa format in add-apt-repository throws a 404 error
- which is not handled appropriately
summary: + Providing wrong ppa format in add-apt-repository throws a 404 error
+ which is not handled appropriately
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in software-properties (Ubuntu):
status: New → Confirmed

I marked that bug as a duplicate of this (I know that was field earlier).

In my branch, I fixed even that error code issue. In my branch I do a sys.exit(1) after handling the HTTpError

Changed in software-properties:
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.82

---------------
software-properties (0.82) precise; urgency=low

  [ Manish Sinha (मनीष सिन्हा) ]
  * lp:~manishsinha/software-properties/fix-887249-handle-404-error:
    - improve error handling for incorrect/misspelled PPAs (LP: #887249)
  * lp:~manishsinha/software-properties/list-ppa-names-for-user-or-team:
    - Made the change to alert the user that a user/team does not have any PPAs

  [ Robert Roth ]
  * lp:~evfool/software-properties/lintianfixes:
    - Fixed capitalization issue in control file
  * Fix warnings logged to terminal about inexistent handlers by checking
    if the handlers exist
  * Change geeky authentication text displayed on policykit auth dialog to
    the one suggested by mpt (LP: #828285)
  * Reset the popcon checkbox value if changed, but auth failed (LP: #874759)
  * Apt-add-repository --remove changed to also remove the debsrc
    line (LP: #838507)
  * Apt-add-repository PPA warning changed to warn you about add/removal
    depending on what you really want to do.
  * Update the manpage of apt-add-repository with the available
    options. (LP: #697546)
  * Reset the text on the mirror testing dialog after closing/canceling
    it (LP: #875679)
  * Unicode encode PPA description and displaynam to avoid
    UnicodeDecodeErrors (LP: #827355)
  * Do not expand the server combobox (LP: #875131)
 -- Michael Vogt <email address hidden> Mon, 21 Nov 2011 16:32:49 +0100

Changed in software-properties (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.