Skip to content

Distro 1.40: possible regression in distro.codename() #238

Closed

Description

@capsalad

Calls to distro.codename() worked as expected in 1.30, but in 1.40 I'm seeing what amounts to truncated output.

Python 3.6.7 on Ubuntu 18.04

1.30 Bionic Beaver
1.40 bionic

Python 3.7.x on Ubuntu 18.10

1.30 Cosmic Cuttlefish
1.40 cosmic

Python 3.7.3 on Ubuntu 19.04

1.30 Disco Dingo
1.40 disco

Python 3.8.2 on Ubuntu 20.04

1.40 focal

I note a possibly breaking change in /etc/os-release, which currently looks like this:

NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Output of lsb_release -a:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal

From the documentation, I thought that, on most Linux distros at least, distro.codename() should produce results identical to awk -F '[()]' '/VERSION=/ {print $2}' /etc/os-release. Is this no longer the case?

Activity

  1. albertodonato commented on Jun 25, 2020

    @albertodonato

    This also breaks compatibility between platform.linux_distribution and distro.linux_distribution:

    >>> platform.linux_distribution(), distro.linux_distribution()
    (('Ubuntu', '18.04', 'bionic'), ('Ubuntu', '18.04', 'Bionic Beaver'))
    
  2. HorlogeSkynet commented on Feb 12, 2022

    @HorlogeSkynet
    Member

    You are right, it looks like #230 broke this, and thus the compatibility shim with platform.linux_distribution.
    Unfortunately, test cases verifying distro.linux_distribution behavior were (and still are) based on Ubuntu 14.04 materials, which do not contain VERSION_CODENAME attribute (so in this case the distribution "id" still comes from VERSION parsing).
    distro.linux_distribution method has been deprecated in distro v1.6.0 (see #296), but I think we should fix this regression anyway as this module is still considered as a drop-in alternative to defunct platform.linux_distribution method.

  3. added 4 commits that reference this issue on Feb 12, 2022
    c39caf0
    2871ef3
    45fe13d
    84b7afd
  4. added a commit that references this issue on Feb 13, 2022
    a08f31b
  5. added a commit that references this issue on Jun 7, 2022
    cd6ab22
  6. added a commit that references this issue on Jun 21, 2022
    9ad12b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions