[issue1322] platform.dist() has unpredictable result under Linux

Bruno Gomes report at bugs.python.org
Mon May 12 04:29:03 CEST 2008


Bruno Gomes <bgomes at s1solucoes.com.br> added the comment:

In this fix I removed the use of the file name in order to return the
distname. Now, only the file contents
is taken into account.

On Centos, the file name is the same as on Redhat, but its contents is
different:
$ cat /etc/redhat-release 
CentOS release 5 (Final)

Compare:

With test_platform_py26.diff:
Python 2.6a3+ (trunk:62996M, May 10 2008, 16:38:41) 
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.dist()
('redhat', '5', 'Final')
>>> 

With the new fix:
Python 2.6a3+ (trunk:62996M, May 10 2008, 16:38:41) 
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.dist()
('CentOS', '5', 'Final')
>>> 

I have tested this fix on Ubuntu, Centos5 and RHEL 5 and it works fine.
Ubuntu: ('Ubuntu', '8.04', 'hardy')
Fedora: ('fedora', '8', 'Werewolf')

----------
nosy: +bgomes
Added file: http://bugs.python.org/file10298/test_platform_py26_fix_centos.diff

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1322>
__________________________________


More information about the Python-bugs-list mailing list