Bug#845651: lsb-release: --codename returns n/a on stretch without apt sources configured

Luca Boccassi <[email protected]> Fri, 25 Nov 2016 15:42:15 +0000
Newsgroups gmane.linux.debian.devel.lsb
Message-ID <1480088535.25750.18.camel__19143.3177482851$1480088731$gmane$org@gmail.com>
--=-Egf4HlkxvsHdvPp695j3
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Package: lsb-release
Version: 9.20161101
Severity: important
Tags: patch

Dear maintainer,

Currently lsb_release parses /etc/debian_version and figures out the
testing codename and stores it. But it never uses it unless apt can be
used, which depends on network access.
Without network access and apt sources downloaded, lsb_release -c on
stretch returns n/a. So a simple way to reproduce it is to comment out
all entries in sources.list(.d/*), apt-get update and running
lsb_release -c on stretch.

The fix is simple and just sets the codename after
parsing /etc/debian_release.
A simple patch is attached.

Thank you!

Kind regards,
Luca Boccassi


=46rom c7de044f737f6df4ba8e6501fcb106aecc83e577 Mon Sep 17 00:00:00 2001
From: Luca Boccassi <[email protected]>
Date: Fri, 25 Nov 2016 15:26:17 +0000
Subject: [PATCH] Fix detecting debian testing release without apt

Currently lsb_release parses /etc/debian_version and figures out the
testing codename and stores it. But it never uses it unless apt can
be used, which depends on network access.
Without network access and apt sources downloaded, lsb_release -c
on stretch returns n/a.
The fix is simple and just sets the codename after parsing
/etc/debian_release.
---
 lsb_release.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lsb_release.py b/lsb_release.py
index 221a321..f134518 100644
--- a/lsb_release.py
+++ b/lsb_release.py
@@ -273,6 +273,7 @@ def guess_debian_release():
             if release.rstrip('/sid').lower() !=3D 'testing':
                 global TESTING_CODENAME
                 TESTING_CODENAME =3D release.rstrip('/sid')
+                distinfo['CODENAME'] =3D release.rstrip('/sid')
             distinfo['RELEASE'] =3D 'testing/unstable'
         else:
             distinfo['RELEASE'] =3D release
--=20
2.1.4

--=-Egf4HlkxvsHdvPp695j3
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAABCAAGBQJYOFvXAAoJEChr9+/NdyQeLKkP/jRY5idA3NzPzixiJFdMzJ9D
Ws2pfg/62G5RcviKedEIRFovRqRe0dWG6UzxmX4UMoYc9fESDkLnrNjTgIqGaaZn
DZKa0Iumh8RpKYrcbdHkwowJdtdiy32jLJiRe7+00xgIw4H4gsYAAY2uBrCC7zrV
EZsP9PBKIdqPcL6HCP/d2BEXQPHyvNBF/kAsiBICG6YiQPu0gXrBIISQusG2Z84X
UDE0P35kfi1riVXEn+MpPBCBsUmydIVe1eMT4BGCdhFQwzIhf6UZ9+5IXLHQgcVk
qCeQ6Rt2gC1P6UeT61KAnigCsFFlBK5QiJX8V/RFN6zPjOkWTFpOW72edMoIhnVS
oaWYQjZPlG3b1kJXW4Xvk3nfAfHOFrHV7y502fCrHm0GsLoUqGM+M2gQIjkJtQTq
TiQrfkXZumxo07YA1OiU8hHgduUz3N3oGTCnn4oUtWN84b8T5I3+z1P+Y7O9DBaP
tbuSa04DQ0K1/CDwOruvY7+XydAloHfICdvV1mNjFv61OMdpdUJALlhcdt72v9xh
l8OiVtUdDdMjO2jfUPsJgpMyVbq9OY8UjZseFtRda+GRQG5BNB1ID8EvKi0g+rCy
W1Bxg4BuocRX5FDpKKf5zsKFHzfVxLHUUHGp3oexWsigEMESDdc8Jf4hpIAk8uyC
l7uSsxWJ1K/zxPMD/J3X
=frkO
-----END PGP SIGNATURE-----

--=-Egf4HlkxvsHdvPp695j3--