[pypy-issue] Issue #2456: platform.linux_distribution() returns the wrong value on ubuntu (pypy/pypy)

Daniele Rolando issues-reply at bitbucket.org
Tue Dec 27 14:38:50 EST 2016


New issue 2456: platform.linux_distribution() returns the wrong value on ubuntu
https://bitbucket.org/pypy/pypy/issues/2456/platformlinux_distribution-returns-the

Daniele Rolando:

```
#!bash

>> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"

>> cat /etc/debian_version
jessie/sid

>> pypy -c "import platform; print platform.linux_distribution()"
('debian', 'jessie/sid', '')

>> python  -c "import platform; print(platform.linux_distribution())"
('Ubuntu', '14.04', 'trusty')
```

The problem is in this loop: [lib-python/2.7/platform.py:323](https://bitbucket.org/pypy/pypy/src/53bc748f8ebb8c098f37bf6e290b3fba1e69926b/lib-python/2.7/platform.py?at=default&fileviewer=file-view-default#platform.py-323)

We get the distribution from the first matching file we encounter in the loop, /etc/debian_version in this case, while we should be reading it from /etc/lsb-release which is more trustworthy.
We should give some priority to these files instead of simply reading the first one.




More information about the pypy-issue mailing list