Bug#681598: /usr/share/pyshared/lsb_release.py: release detection fails with http.debian.net redirector in sources.list

Nikolaus Rath <[email protected]>
Newsgroups gmane.linux.debian.devel.lsb
Message-ID <20120714154548.10808.70477.reportbug__31307.5707214468$1342282696$gmane$org@vostro.rath.org>
Package: lsb-release
Version: 4.1+Debian7
Severity: normal
File: /usr/share/pyshared/lsb_release.py

With the following sources.list:

| deb-src http://mirror.cc.columbia.edu/debian/ testing main contrib non-free
| deb http://mirror.cc.columbia.edu/debian/ testing main contrib non-free

the output of lsb_release.get_distro_information is correct:

In [4]: lsb_release.get_distro_information()
Out[4]: 
{'CODENAME': 'wheezy',
 'DESCRIPTION': u'Debian GNU/Linux testing (wheezy)',
 'ID': 'Debian',
 'OS': 'GNU/Linux',
 'RELEASE': u'testing'}


When using the http.debian.net redirector, though

| deb-src http://http.debian.net/debian/ testing main contrib non-free
| deb http://http.debian.net/debian/ testing main contrib non-free

the detection fails:

In [3]: lsb_release.parse_apt_policy()
Out[3]: 
[(100, {'suite': u'now'}),
 (500,
  {'component': u'',
   'label': u'Jitsi Debian packages repository',
   'origin': u'jitsi.org',
   'suite': u'unstable'}),
 (100,
  {'component': u'non-free',
   'label': u'Unofficial Multimedia Packages',
   'origin': u'Unofficial Multimedia Packages',
   'suite': u'testing',
   'version': u'None'}),
 (100,
  {'component': u'main',
   'label': u'Unofficial Multimedia Packages',
   'origin': u'Unofficial Multimedia Packages',
   'suite': u'testing',
   'version': u'None'}),
 (500,
  {'component': u'non-free',
   'label': u'Debian',
   'origin': u'Debian',
   'suite': u'testing'}),
 (500,
  {'component': u'contrib',
   'label': u'Debian',
   'origin': u'Debian',
   'suite': u'testing'}),
 (500,
  {'component': u'main',
   'label': u'Debian',
   'origin': u'Debian',
   'suite': u'testing'})]


This is annoying, because when using ${distro_codename} in /etc/apt/apt.conf.d/50unattended-upgrades, 

Unattended-Upgrade::Origins-Pattern {
        "o={distro_id},a=${distro_codename}";
        "o={distro_id},a=${distro_codename}-updates";
        "o={distro_id},a=${distro_codename},l=Debian-Security";
};


unattended-upgrades fails with

Traceback (most recent call last):
  File "/usr/bin/unattended-upgrade", line 55, in <module>
    DISTRO_CODENAME = lsb_release.get_distro_information()['CODENAME']
KeyError: 'CODENAME'




-- Package-specific info:
lsb_release output
-*- -*- -*- -*- -*-
Distributor ID:	Debian
Description:	Debian GNU/Linux testing (wheezy)
Release:	testing
Codename:	wheezy
-*- -*- -*- -*- -*-
    Apt policy
-*- -*- -*- -*- -*-
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 http://download.jitsi.org/deb/ unstable/ Packages
     release o=jitsi.org,a=unstable,n=sid,l=Jitsi Debian packages repository,c=
     origin download.jitsi.org
 100 http://www.debian-multimedia.org/ testing/non-free amd64 Packages
     release v=None,o=Unofficial Multimedia Packages,a=testing,n=wheezy,l=Unofficial Multimedia Packages,c=non-free
     origin www.debian-multimedia.org
 100 http://www.debian-multimedia.org/ testing/main amd64 Packages
     release v=None,o=Unofficial Multimedia Packages,a=testing,n=wheezy,l=Unofficial Multimedia Packages,c=main
     origin www.debian-multimedia.org
 500 http://mirror.cc.columbia.edu/debian/ testing/non-free Translation-en
 500 http://mirror.cc.columbia.edu/debian/ testing/main Translation-en
 500 http://mirror.cc.columbia.edu/debian/ testing/contrib Translation-en
 500 http://mirror.cc.columbia.edu/debian/ testing/non-free amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=non-free
     origin mirror.cc.columbia.edu
 500 http://mirror.cc.columbia.edu/debian/ testing/contrib amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=contrib
     origin mirror.cc.columbia.edu
 500 http://mirror.cc.columbia.edu/debian/ testing/main amd64 Packages
     release o=Debian,a=testing,n=wheezy,l=Debian,c=main
     origin mirror.cc.columbia.edu
Pinned packages:
-*- -*- -*- -*- -*-
   sources.list
-*- -*- -*- -*- -*-
deb-src http://mirror.cc.columbia.edu/debian/ testing main contrib non-free
deb http://mirror.cc.columbia.edu/debian/ testing main contrib non-free
deb http://www.debian-multimedia.org testing main non-free
-*- -*- -*- -*- -*-
 /etc/lsb_release
-*- -*- -*- -*- -*-
- none

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-3-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages lsb-release depends on:
ii  python     2.7.3~rc2-1
ii  python2.6  2.6.8-0.2
ii  python2.7  2.7.3~rc2-2.1

Versions of packages lsb-release recommends:
ii  apt  0.9.7.1

Versions of packages lsb-release suggests:
pn  lsb  <none>

-- no debconf information
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.