[Bug 997614] New: python's platform.linux_distribution() doesn't understand /etc/os-release
http://bugzilla.suse.com/show_bug.cgi?id=997614 Bug ID: 997614 Summary: python's platform.linux_distribution() doesn't understand /etc/os-release Classification: openSUSE Product: openSUSE Tumbleweed Version: Current Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: bnc-team-screening@forge.provo.novell.com Reporter: tserong@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: ---
cat /etc/SuSE-release cat: /etc/SuSE-release: No such file or directory
cat /etc/os-release NAME="openSUSE Tumbleweed" # VERSION="20160831" ID=opensuse ID_LIKE="suse" VERSION_ID="20160831" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20160831" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/"
python -c 'import platform ; print platform.linux_distribution()' ('', '', '')
That's odd. Python doesn't know what distro we're running on. But, on an earlier Tumbleweed release:
cat /etc/SuSE-release openSUSE 20160701 (x86_64) VERSION = 20160701 CODENAME = Tumbleweed # /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead
cat /etc/os-release NAME=openSUSE VERSION="Tumbleweed" VERSION_ID="20160701" PRETTY_NAME="openSUSE Tumbleweed (20160701) (x86_64)" ID=opensuse ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:opensuse:20160701" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" ID_LIKE="suse"
python -c 'import platform ; print platform.linux_distribution()' ('openSUSE ', '20160701', 'x86_64')
Turns out the file matching in /usr/lib64/python2.7/platform.py (line 323+) is looking for files named /(\w+)[-_](release|version)/, so it picks up "os-release", and decides _distname is "os", which *isn't* in _supported_dists (_supported_dists includes "SuSE", "debian", "fedora", etc. but no generic "os"). So, as we apparently no longer ship SuSE-release, and there's no other release-like files to parse, and we end up with platform.linux_distribution() having no idea what's going on. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=997614
Nathan Cutler
http://bugzilla.suse.com/show_bug.cgi?id=997614
Chenzi Cao
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c1
Tim Serong
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c5
Guilherme Moro
http://bugzilla.suse.com/show_bug.cgi?id=997614
Michal Nowak
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c6
Robert Schweikert
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c7
--- Comment #7 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c8
Jan Matejek
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c9
Guilherme Moro
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c10
Jan Matejek
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c11
--- Comment #11 from Robert Schweikert
import platform platform.dist() ('', '', '')
Here the argument of "it's deprecated" is not valid at all as the function is marked deprecated in 3.5+ . I understand that Python 2 is supposed to disappear from TW, but in SLE 15 the Legacy Module with contain Python 2 which will have support for 2 years after release and I expect the behavior of Python 2 in SLE 15 to mimic that of TW, i.e. the function is broken. On TW: -> python3 Python 3.6.4 (default, Jan 03 2018, 13:52:55) [GCC] on linux Type "help", "copyright", "credits" or "license" for more information.
import platform platform.dist() ('', '', '')
".... Features are deprecated rather than immediately removed, to provide backward compatibility, and to give programmers time to bring affected code into compliance with the new standard." from [1]. How we are providing a transition period when we are simply breaking the feature? [1] https://en.wikipedia.org/wiki/Deprecation -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c12
Guilherme Moro
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c16
--- Comment #16 from Tomáš Chvátal
(In reply to Sebastian Wagner from comment #14)
python-distro has now been accepted to Leap 15: https://build.opensuse.org/request/show/577480
Probably this issue is resolved then?
Well that depends. As pointed out in comment #11 deprecated != broken. The two packages I know off that use platform.linux_distribution have been fixed.
cloud-init -> has it's own implementation to determine the Linux distribution, our package is patched and upstream accepted my changes for 18.1 release.
python-azure-agent -> uses python-distro now, our package has been patched but not yet submitted to SLE 15, still needs testing. I am also still working on the final format of the patch with upstream.
That is lovely but we would have to reimplement the function as whole, because it has no idea for the os-release file at all, it simply just parses /etc/*-release and anticipates the old format of the files. It is easy to extend it to load up the os-release, by simply adding 'os' to known distributions, but then what should be the desired content from the os-release... It takes only the first line which used to be like "openSUSE 20160701 (x86_64)" and grabs the distro, version and arch from there... But current os-release does not even account for the platform, thats why it was completely replaced by new module. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c17
Tomáš Chvátal
http://bugzilla.suse.com/show_bug.cgi?id=997614
SMASH SMASH
http://bugzilla.suse.com/show_bug.cgi?id=997614
Jan Matejek
http://bugzilla.suse.com/show_bug.cgi?id=997614
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c20
--- Comment #20 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c21
--- Comment #21 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c25
Matej Cepl
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c28
--- Comment #28 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=997614
http://bugzilla.suse.com/show_bug.cgi?id=997614#c31
Matej Cepl
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c33
--- Comment #33 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
Nathan Cutler
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c38
--- Comment #38 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c39
--- Comment #39 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c40
--- Comment #40 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c41
--- Comment #41 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c43
--- Comment #43 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c37
--- Comment #37 from Swamp Workflow Management
https://bugzilla.suse.com/show_bug.cgi?id=997614
https://bugzilla.suse.com/show_bug.cgi?id=997614#c42
--- Comment #42 from Swamp Workflow Management
participants (2)
-
bugzilla_noreply@novell.com
-
bugzilla_noreply@suse.com