Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uname_info() return empty string on ubuntu20.04 and Fedora34 #322

Open
braindevices opened this issue Jan 12, 2022 · 3 comments
Open

uname_info() return empty string on ubuntu20.04 and Fedora34 #322

braindevices opened this issue Jan 12, 2022 · 3 comments

Comments

@braindevices
Copy link

is this expected?

distro.__version__
 '1.6.0'

print(distro.uname_info())
{}
@sethmlarson
Copy link
Contributor

Maybe? What does running uname -a print on those platforms?

@braindevices
Copy link
Author

the uname installed fine.

distro.LinuxDistribution(include_uname=True)
LinuxDistribution(os_release_file='/etc/os-release', distro_release_file='', include_lsb=True, include_uname=True, _os_release_info={'name': 'Ubuntu', 'version': '20.04.4 LTS (Focal Fossa)', 'id': 'ubuntu', 'id_like': 'debian', 'pretty_name': 'Ubuntu 20.04.4 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', 'codename': 'focal'}, _lsb_release_info={'distributor_id': 'Ubuntu', 'description': 'Ubuntu 20.04.4 LTS', 'release': '20.04', 'codename': 'focal'}, _distro_release_info={}, _uname_info={})

subprocess.check_output(('uname', '-rs'))
b'Linux 5.4.0-109-generic\n'

Any idea what happens here?

@braindevices
Copy link
Author

I finally have time to dig into this. It turns out the uname content parser returns empty dict by design. So the uname_info() is actually never supposed to be called outside. It is merely a fallback method to get the distro id and distro version for some os such as AIX or some mac os. And even for those os the uname_info() does not really return the full kernel version.

So I think we should NOT expose the uname_info() and uname_attr() to user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants