Bug#845651: marked as done (lsb-release: --codename returns n/a on stretch without apt sources configured)

[email protected] (Debian Bug Tracking System) Sun, 08 Jan 2017 19:39:06 +0000
Newsgroups gmane.linux.debian.devel.lsb
Message-ID <[email protected]>
This is a multi-part message in MIME format...

------------=_1483904346-27428-0
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=utf-8

Your message dated Sun, 08 Jan 2017 19:35:13 +0000
with message-id <[email protected]>
and subject line Re: Bug#845651: lsb-release: --codename returns n/a on str=
etch without apt sources configured
has caused the Debian Bug report #845651,
regarding lsb-release: --codename returns n/a on stretch without apt source=
s configured
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


--=20
845651: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=3D845651
Debian Bug Tracking System
Contact [email protected] with problems

------------=_1483904346-27428-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at submit) by bugs.debian.org; 25 Nov 2016 15:42:32 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02
	(2014-02-07) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-12.6 required=4.0 tests=BAYES_00,DIGITS_LETTERS,
	DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HAS_PACKAGE,
	MURPHY_DRUGS_REL8,PGPSIGNATURE,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_CNKR
	autolearn=ham autolearn_force=no version=3.4.0-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 28; hammy, 150; neutral, 88; spammy,
	0. spammytokens: hammytokens:0.000-+--H*c:pgp-sha256, 0.000-+--H*x:3.12.9-1,
	0.000-+--H*UA:3.12.9-1, 0.000-+--H*c:pgp-signature, 0.000-+--H*c:protocol
Return-path: <[email protected]>
Received: from mail-pg0-x236.google.com ([2607:f8b0:400e:c05::236])
	by buxtehude.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
	(Exim 4.84_2)
	(envelope-from <[email protected]>)
	id 1cAIe0-0002wB-2a
	for [email protected]; Fri, 25 Nov 2016 15:42:32 +0000
Received: by mail-pg0-x236.google.com with SMTP id x23so30922958pgx.1
        for <[email protected]>; Fri, 25 Nov 2016 07:42:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=message-id:subject:from:to:date:mime-version;
        bh=8OpxKc+ivAhxD5bpanR4GxdJhDsI3j72LC6bkAlR/GE=;
        b=p4RGxS/TQg7l5RE6HHyb2H/jn/NtDW8F5XigLehP+ilfiPOeAbk8yFFHijg1U5UDNB
         ha9tlh+i4mkvFoWYIUNXOtLGIAycP8XUAVd5fYRW4Yt4ZHbIOtacP+eNH7TJ+2rNzRJp
         lPYWF986g6Eq2AZEQ3h+8f36OQsVVqxz+O3Xb7efm0YYX71QNkJrpAFvjokKoUXUt2a6
         s/TgqNEJbivsbM8ZO2m/d+sFFcb087oRzGH2Tcq1r1AExKhrmoIMbWK53RfytEPzqQIG
         vbx2ar3wcqu6/vsK8cNWM+7NjduyUxSNNQDGzIyUltzKx/oN3P6j770WWpNqrpiaxeXv
         v7QQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:message-id:subject:from:to:date:mime-version;
        bh=8OpxKc+ivAhxD5bpanR4GxdJhDsI3j72LC6bkAlR/GE=;
        b=fTNgMvgNIkHPGovf+ctFNgSvIA9vs3kXEpXxsVKk7D84kXk31Mf9XjX96T3cvNdKcy
         9ZXn3HXAQZP7IDZzmsQLOmQteXg/hKksXS23d9Mp2IhheH1ZdjPL7S0/8P0+Pc6KjTze
         gu5pfwD5jVhL0kTSBj0JqMrmw2u2qxlN1FJD+VYYUONC3vocvs/L/D4mjjipJVwnaygP
         SAyreYKe+W0YDYm5aFvIT0epoZke3Fb4P8AVto+1LWnCnI8IHUo/MHlEOCGQWc6EiYfZ
         oVzUhxOyrqKzlfGsdAnqufHy+3XvtYI8RAydqQ8uC7uody6geFk5QxhdugUY1qQFbBL8
         j5oA==
X-Gm-Message-State: AKaTC029WQGB1GlgC8IkW7im4AwNpIr/NH4vo8RDpivbW77Cn2Ioc+EF5vPXhrrGqQ9ITA==
X-Received: by 10.84.209.161 with SMTP id y30mr19021944plh.163.1480088545736;
        Fri, 25 Nov 2016 07:42:25 -0800 (PST)
Received: from localhost (212.44.21.120.ip.redstone-isp.net. [212.44.21.120])
        by smtp.gmail.com with ESMTPSA id c15sm68806184pfd.36.2016.11.25.07.42.23
        for <[email protected]>
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Fri, 25 Nov 2016 07:42:24 -0800 (PST)
Message-ID: <[email protected]>
Subject: lsb-release: --codename returns n/a on stretch without apt sources
 configured
From: Luca Boccassi <[email protected]>
To: "[email protected]" <[email protected]>
Date: Fri, 25 Nov 2016 15:42:15 +0000
Content-Type: multipart/signed; micalg="pgp-sha256";
	protocol="application/pgp-signature"; boundary="=-Egf4HlkxvsHdvPp695j3"
X-Mailer: Evolution 3.12.9-1+b1 
Mime-Version: 1.0
Delivered-To: [email protected]


--=-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--

------------=_1483904346-27428-0
Content-Type: message/rfc822
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Received: (at 845651-done) by bugs.debian.org; 8 Jan 2017 19:35:26 +0000
X-Spam-Checker-Version: SpamAssassin 3.4.0-bugs.debian.org_2005_01_02
	(2014-02-07) on buxtehude.debian.org
X-Spam-Level: 
X-Spam-Status: No, score=-10.4 required=4.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HAS_BUG_NUMBER,PGPSIGNATURE,
	RCVD_IN_DNSWL_LOW,SPF_PASS,URIBL_CNKR autolearn=ham autolearn_force=no
	version=3.4.0-bugs.debian.org_2005_01_02
X-Spam-Bayes: score:0.0000 Tokens: new, 35; hammy, 150; neutral, 154; spammy,
	0. spammytokens: hammytokens:0.000-+--H*c:pgp-sha256, 0.000-+--H*UA:3.12.9-1,
	0.000-+--H*x:3.12.9-1, 0.000-+--HX-Google-DKIM-Signature:in-reply-to,
	0.000-+--raboud
Return-path: <[email protected]>
Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241])
	by buxtehude.debian.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
	(Exim 4.84_2)
	(envelope-from <[email protected]>)
	id 1cQJFW-0006v7-Ct
	for [email protected]; Sun, 08 Jan 2017 19:35:26 +0000
Received: by mail-wm0-x241.google.com with SMTP id m203so17257352wma.3
        for <[email protected]>; Sun, 08 Jan 2017 11:35:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=message-id:subject:from:to:cc:date:in-reply-to:references
         :mime-version;
        bh=jfbs7768eeevKe4L1LB5atQWEtlNB6ZcXLZBO0LkTCY=;
        b=H13rSd8v+fHjPGPdWiT28iiUNeRuqqzuLmXJEZb1/vVP3yLI/9sbla+D+7fUsdUCdD
         2cHf8hj5zbbcyxE8Xv66d0O3HaQ1J5sc5rQEoy6TzgNMAeb3X1lXOJncveN3uPqKezin
         rWoabmjLyUjitfsx5gQzpaXel83DLNcrpc2KbWzvufct1Yyst2FpRi3JHv9vw36GBDpv
         /OvJxG3DFFtksqeYTA1lwbvY+F6Q9e8RBVpnKN50zEhDUclhiI7nWX3y5TYEpMtlBxai
         YeV0gzl03A9erh95XIcSHCu+KPnUBcMabOZnAMa67IjMDhReBTJuO3SIU1OTKkn8zHA1
         +ouw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to
         :references:mime-version;
        bh=jfbs7768eeevKe4L1LB5atQWEtlNB6ZcXLZBO0LkTCY=;
        b=Bc1k2wFdps+uUXqZQvp8+6qupl/bUN2rtsr2ZU5V1cAsiyFcROajdDSfRAw913ozD3
         SUZPBXSpvMQjT+6eb6/MjP8k4jrcLMGRmK1KOjtqC3XcPMaMYWthLB+3gdi1PN0GKKE7
         7gLhVNeftfekhyDnkb5b4XROiO62/VXAH9Bluxc3n3yVYXwcuKg2QKHFP3MvKM0XIVSy
         9c1k51X+ByPmOMbJ0c+fATZeasbnYkzNVep3TWKkcNyRwfdXTG9ZErjiEZ4ohVvw/Ggv
         XvEvl35T7cUhy1Qk7G/YVU4U8lsurCHBH6X5fEieygfa7gjTE/WmIvIHmlnoTbGtkFX1
         G9gQ==
X-Gm-Message-State: AIkVDXKB6oIKtov9FnR5bKugNNv+ne60noPd7dp/K6KRhLiwrM5mpVmKW6SLERv0i08M7g==
X-Received: by 10.223.138.9 with SMTP id w9mr692701wrw.50.1483904119031;
        Sun, 08 Jan 2017 11:35:19 -0800 (PST)
Received: from localhost ([2a00:23c1:be89:7300:4a51:b7ff:fe0b:4749])
        by smtp.gmail.com with ESMTPSA id y3sm90188159wjy.34.2017.01.08.11.35.17
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Sun, 08 Jan 2017 11:35:18 -0800 (PST)
Message-ID: <[email protected]>
Subject: Re: Bug#845651: lsb-release: --codename returns n/a on stretch
 without apt sources configured
From: Luca Boccassi <[email protected]>
To: Didier 'OdyX' Raboud <[email protected]>
Cc: [email protected]
Date: Sun, 08 Jan 2017 19:35:13 +0000
In-Reply-To: <[email protected]>
References: 
	<CAMw=ZnS0ij-etU=5AocsBnYKE11r73RdmkKHYCJ7sBOSveU_Zw@mail.gmail.com>
	 <[email protected]>
Content-Type: multipart/signed; micalg="pgp-sha256";
	protocol="application/pgp-signature"; boundary="=-J8duyzSMJt1ZhRV0umfj"
X-Mailer: Evolution 3.12.9-1+b1 
Mime-Version: 1.0


--=-J8duyzSMJt1ZhRV0umfj
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Sun, 2017-01-08 at 18:37 +0100, Didier 'OdyX' Raboud wrote:
> Control: tags -1 +wontfix=20
>=20
> Hi there Luca,
>=20
> Le dimanche, 8 janvier 2017, 14.54:16 h CET Luca Boccassi a =C3=A9crit :
> > Any chance this could be looked at before Stretch final freeze? Thank y=
ou!
>=20
> tl;dr: unfortunately not.
>=20
> I have thought about this issue for some time, and I think that the resul=
t is=20
> actually correct. Let me explain:
>=20
> When (as currently), stretch is the testing release, /etc/debian_version=
=20
> contains "stretch/sid", as shipped by base-files. It is therefore impossi=
ble=20
> to rely on that file to differentiate between a host running testing or=
=20
> unstable without asking apt what is actually preferred when installing=
=20
> packages (through parsing `apt-cache policy`). That's how `lsb-release --
> codename` returns "sid" _xor_ "stretch".
>=20
> stretch's base-files is currently in version 9.7, and ships with "stretch=
/sid"=20
> in /etc/debian_version. But if you look at base-files in the current stab=
le=20
> (8+deb8u6), its /etc/debian_version currently contains "8.6", and with th=
at,=20
> `lsb-release --codename` returns "jessie" consistently, and without relyi=
ng on=20
> apt.
>=20
> base-files will be updated in stretch for the release, as happened for je=
ssie:
> > * Release for jessie as stable:
> >   - Use "8" as version in /etc/issue and /etc/issue.net. As usual, this
> >     is never expected to change once that jessie is released as Debian =
8.
> >   - Use 8.0 as version in /etc/debian_version. As usual, this is expect=
ed
> >     to change at every point release.
>=20
> So, if you manually replace your /etc/debian_version's content by "9.0", =
you=20
> should get "stretch" consistently, no matter what your apt configuration =
is.
>=20
> That's all to say that this bug is (to my belief) actually expected behav=
iour;=20
> and fixing it through forcing the codename to be interpreted as "stretch"=
 when=20
> apt-cache information is unavailable would be wrong. When /etc/debian_ver=
sion=20
> contains "potato/sid", the codename is either potato xor sid, and only ap=
t-
> cache can discriminate a testing host from a sid host. Therefore, in such=
 a=20
> situation, the correct answer is actually "I can't tell", aka "n/a".

Hello Didier,

Thank you for your answer, it makes sense. We build only for testing
internally so I did not consider the unstable case at first but I
understand now, so closing the bug.

Kind regards,
Luca Boccassi

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

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

iQIcBAABCAAGBQJYcpRxAAoJEChr9+/NdyQeOPoP/A9XkwZmXRsFIZHssMnjbFvo
tQEx2LEF/HuHeAsLu/gTckcO0IUaBYy9vYnn8oVZkul5pbn2B4FuQ1Z0937DtDii
/4FFNC8j5+V1N9CKB/qzpDoejIM5YRkWe6/+O2+OuhD0w9V7AxXT+9mVq5wSK2F0
Gf9bFBfpQ4p7bxs92yvH383uikO/svZgslF5W/Lct+uqN/EdzNZj5vH+9nCtWs4/
LVwlpr7FRci2QOXEFu5+IKIJtT4QqDw/tLUc1bGDPIhjGFgFpihGmIvd2LZgX+fi
uKgkwO+iAZ2rUC0SeL1vaVf24N0y9ic0TFAbzK0rXETJln9rT13Cax4Yf6wZCb76
3frIISGb6ra/ABa+fmXa6GFl06ppImmslY7vP1PDX+vnxCvvQwhyjeHJwcqxUqEK
T2Wo6zmXEfTY+MJQ2HRIhUzLYl6ayFbbd/bi207oi/OYt/TriCixykWuNwEl7Y0F
W48OnIp44BuYw4zoftqgHCIunA6WTtelREJbCkhjknR23iNQp0HhKfk4eXCQTOzn
1syZ4OwrB9iVsW6DBKpjHNa7W/14tu0jjHrtzCdBFbPzqzh78fa8j36+JfNz6yqh
dHKUbE9un+WWwQQA6KvAQeMEhOEbJvcfrKRb5wQhoMkAl80yy+TWlCt044dV5bq1
pz22slqHFj5CFzCAV/Ng
=6C8D
-----END PGP SIGNATURE-----

--=-J8duyzSMJt1ZhRV0umfj--
------------=_1483904346-27428-0--