/usr/sbin/apt-add-repository will not function with IPv6 proxies called by address

Bug #2013545 reported by Matt Clauson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
New
Undecided
Unassigned

Bug Description

It appears that if one has an HTTP or HTTPS proxy called out specifically by IPv6 address rather than hostname, it will fail. Placing an entry in /etc/hosts, or the proxy into DNS (and calling by hostname) will function.

failure steps:

1) set proxy environment variables
  export http_proxy="http://[2001:db8:f00::2]:3128/"
  export https_proxy="http://[2001:db8:f00::2]:3128/"

2) Attempt to add repository (in this case, a PPA):
  apt-add-repository ppa:ansible/ansible

3) Enjoy the resulting stack trace:
Traceback (most recent call last):
  File "/usr/bin/apt-add-repository", line 364, in <module>
    sys.exit(0 if addaptrepo.main() else 1)
  File "/usr/bin/apt-add-repository", line 347, in main
    shortcut = handler(source, **shortcut_params)
  File "/usr/lib/python3/dist-packages/softwareproperties/shortcuts.py", line 40, in shortcut_handler
    return handler(shortcut, **kwargs)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 82, in __init__
    if self.lpppa.publish_debug_symbols:
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 120, in lpppa
    self._lpppa = self.lpteam.getPPAByName(name=self.ppaname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 107, in lpteam
    self._lpteam = self.lp.people(self.teamname)
  File "/usr/lib/python3/dist-packages/softwareproperties/ppa.py", line 98, in lp
    self._lp = login_func("%s.%s" % (self.__module__, self.__class__.__name__),
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 494, in login_anonymously
    return cls(
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 230, in __init__
    super(Launchpad, self).__init__(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/resource.py", line 472, in __init__
    self._wadl = self._browser.get_wadl_application(self._root_uri)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 447, in get_wadl_application
    response, content = self._request(url, media_type=wadl_type)
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 389, in _request
    response, content = self._request_and_retry(
  File "/usr/lib/python3/dist-packages/lazr/restfulclient/_browser.py", line 359, in _request_and_retry
    response, content = self._connection.request(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1578, in request
    conn = self.connections[conn_key] = connection_type(
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 1095, in __init__
    self.proxy_info = proxy_info("https")
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 926, in proxy_info_from_environment
    return proxy_info_from_url(url, method, noproxy=None)
  File "/usr/lib/python3/dist-packages/httplib2/__init__.py", line 950, in proxy_info_from_url
    port = int(port)
ValueError: invalid literal for int() with base 10: 'db8:f00::2]:3128'

Ubuntu Release:
# lsb_release -rd
Description: Ubuntu 22.04.2 LTS
Release: 22.04

Package version:
# apt-cache policy software-properties-common
software-properties-common:
  Installed: 0.99.22.6
  Candidate: 0.99.22.6
  Version table:
 *** 0.99.22.6 500
        500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     0.99.22 500
        500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Tags: ipv6 proxy
Revision history for this message
Matt Clauson (mec-dotorg) wrote :

On another reading of this, it looks like the issue may end up being in dependency (and upstream package) httplib2. I'd like a sanity check on that, and I'm willing to file tickets in other packages or upstream as soon as I have cycles. I'm buried in the middle of another project right now, but I wanted to get the issue documented for any other poor souls running into it in the future.

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.