Better error handling of apt-add-repository

Bug #1053531 reported by Ma Hsiao-chun
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

If I issue "sudo add-apt-repository ppa:ubuntu-wine/ppa" without Internet connected.
I get something like this.

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 125, in <module>
    ppa_info = get_ppa_info_from_lp(user, ppa_name)
  File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 80, in get_ppa_info_from_lp
    curl.perform()
pycurl.error: (6, "Couldn't resolve host 'launchpad.net'")

Some other users reported that they got similar things for unknown reasons.
(From http://forum.ubuntu.org.cn/viewtopic.php?t=381149)

Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_ppa_info_from_lp(user, ppa_name)
File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 80, in get_ppa_info_from_lp
curl.perform()
pycurl.error: (7, "couldn't connect to host")

Errors are possible and acceptable.
However, such error messages mentioned above are insane.
Please fix it.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: software-properties-common 0.82.7.2
ProcVersionSignature: Ubuntu 3.2.0-30.48-generic 3.2.27
Uname: Linux 3.2.0-30-generic x86_64
ApportVersion: 2.0.1-0ubuntu13
Architecture: amd64
Date: Thu Sep 20 12:14:21 2012
InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release amd64 (20120823.1)
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no username)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: software-properties
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in software-properties (Ubuntu):
status: New → Confirmed
Revision history for this message
Scott Testerman (scott-testerman) wrote :

Agreed that error handling should generally be more graceful. For instance, one is informed when adding a PPA that it is possible to cancel the addition by pressing Ctrl-C, but the result is:

Press [ENTER] to continue or ctrl-c to cancel adding it
^CTraceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 158, in <module>
    sys.stdin.readline()
KeyboardInterrupt

Why not catch the interrupt and simply print an "installation aborted" message?

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.