Network connectivity check pings network location, not hostname

Bug #1032732 reported by Bjorn Swift
This bug affects 2 people
Affects Status Importance Assigned to Milestone
software-center (Ubuntu)

Bug Description

The Ubuntu Software Center attempts to ping the repository host on startup to check for internet connectivity (when NetworkManager is not present). However, the software-center uses the complete network location (urlparse's netloc) as the ping destination - which causes problems if the location contains a port component (or basic authentication).

For example, our repository url is When we start software-center, it attempts to ping "", which fails, and so the Install button is grayed out.

Log output:
INFO - Attempting one time ping of to test if internet connectivity exists.

The following patch uses urlparse's hostname instead of netloc (also attached):

--- 2012-08-03 05:27:37.913582505 +0000
+++ 2012-08-03 05:44:54.645406601 +0000
@@ -145,7 +145,7 @@
         # get a host to ping
- host = urlparse(source_list.list[0].uri)[1]
+ host = urlparse(source_list.list[0].uri).hostname
         msg = ("Attempting one time ping of %s to test if internet "
                "connectivity exists." % host)

After applying patch:
INFO - Attempting one time ping of to test if internet connectivity exists.

== OS and package versions ==

# lsb_release -rd
Description: Ubuntu 12.04 LTS
Release: 12.04

# apt-cache policy software-center
  Installed: 5.2.4
  Candidate: 5.2.4

Tags: patch
Revision history for this message
Bjorn Swift (1-bjorn) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Substitute netloc with hostname" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

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