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

Didier 'OdyX' Raboud <[email protected]> Sun, 08 Jan 2017 18:37:14 +0100
Newsgroups gmane.linux.debian.devel.lsb
Organization Debian - The Universal OS
Message-ID <17901521.EkCHVj4dQh__35263.1289781586$1483897169$gmane$org@odyx.org>
Control: tags -1 +wontfix=20

Hi there Luca,

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 you!

tl;dr: unfortunately not.

I have thought about this issue for some time, and I think that the result =
is=20
actually correct. Let me explain:

When (as currently), stretch is the testing release, /etc/debian_version=20
contains "stretch/sid", as shipped by base-files. It is therefore impossibl=
e=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".

stretch's base-files is currently in version 9.7, and ships with "stretch/s=
id"=20
in /etc/debian_version. But if you look at base-files in the current stable=
=20
(8+deb8u6), its /etc/debian_version currently contains "8.6", and with that=
,=20
`lsb-release --codename` returns "jessie" consistently, and without relying=
 on=20
apt.

base-files will be updated in stretch for the release, as happened for jess=
ie:
> * 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 expected
>     to change at every point release.

So, if you manually replace your /etc/debian_version's content by "9.0", yo=
u=20
should get "stretch" consistently, no matter what your apt configuration is.

That's all to say that this bug is (to my belief) actually expected behavio=
ur;=20
and fixing it through forcing the codename to be interpreted as "stretch" w=
hen=20
apt-cache information is unavailable would be wrong. When /etc/debian_versi=
on=20
contains "potato/sid", the codename is either potato xor sid, and only apt-
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".

=2D-=20
Cheers,
    OdyX