Skip to content

distro crashes when non-ASCII character appears in lsb_release #151

@adamjstewart

Description

@adamjstewart

We're using the distro package for linux distribution detection in a package manager called Spack. Unfortunately, one of our users discovered a bug that causes distro to crash with the following error message:

File "distro.py", line 1049, in 
    _distroi = LinuxDistribution()
File "distro.py", line 595, in init
    if include_lsb else {}
File "distro.py", line 921, in _lsb_release_info
    out, err = out.decode('ascii'), err.decode('ascii')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 250: ordinal not in range(128)

Here is their lsb_release:

$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 19 (Schrödinger’s Cat)
Release: 19
Codename: Schrödinger’sCat

I assume the problem is that distro can't handle the ö in Schrödinger’s Cat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions