You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
On Linux, there are many difference files that can provide distribution details. gopsutil should adopt a hierarchy for checking those files, using the information from the first file found.
Describe the solution you'd like
While gopsutil does currently adopt this kind of approach, the order of checks could be improved. My suggestion would be something like:
/etc/os-release
/etc/lsb-release
/etc/*[version|release]
Above, preference the general standards/guideline files first, then the distro-specific files. /etc/os-release appears to be adopted widely, and often contains much more specific information (regarding distribution variants) than the other sources. While /etc/lsb-release usage appears to be waning and discouraged, it is still an important source for this information. The remaining files such as /etc/redhat-release, /etc/SuSE-release, /etc/debian_version, /etc/arch-release, /etc/gentoo-release, /etc/slackware-version, /etc/frugalware-release, /etc/altlinux-release, /etc/mandriva-release, /etc/meego-release, /etc/angstrom-version, /etc/mageia-release may or may not contain variant-specific information.
For example, I would image a lot of variants based on Debian do not edit /etc/debian_version and so relying on this first will report the wrong information (the debian base version, not the variant version). Likewise, if I was going to build my own distribution based on Fedora, I would likely leave /etc/redhat-release untouched and place my distribution information in the /etc/os-release file.
Describe alternatives you've considered
For my own usage, my alternative would be to just write my own code to apply the above order.
Additional context
Preferencing /etc/os-release over /etc/debian_release for example should fix #1469 and #224 and likely avoid similar issues in the future.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
On Linux, there are many difference files that can provide distribution details. gopsutil should adopt a hierarchy for checking those files, using the information from the first file found.
Describe the solution you'd like
While gopsutil does currently adopt this kind of approach, the order of checks could be improved. My suggestion would be something like:
/etc/os-release
/etc/lsb-release
/etc/*[version|release]
Above, preference the general standards/guideline files first, then the distro-specific files.
/etc/os-release
appears to be adopted widely, and often contains much more specific information (regarding distribution variants) than the other sources. While/etc/lsb-release
usage appears to be waning and discouraged, it is still an important source for this information. The remaining files such as/etc/redhat-release
,/etc/SuSE-release
,/etc/debian_version
,/etc/arch-release
,/etc/gentoo-release
,/etc/slackware-version
,/etc/frugalware-release
,/etc/altlinux-release
,/etc/mandriva-release
,/etc/meego-release
,/etc/angstrom-version
,/etc/mageia-release
may or may not contain variant-specific information.For example, I would image a lot of variants based on Debian do not edit
/etc/debian_version
and so relying on this first will report the wrong information (the debian base version, not the variant version). Likewise, if I was going to build my own distribution based on Fedora, I would likely leave/etc/redhat-release
untouched and place my distribution information in the/etc/os-release
file.Describe alternatives you've considered
For my own usage, my alternative would be to just write my own code to apply the above order.
Additional context
Preferencing
/etc/os-release
over/etc/debian_release
for example should fix #1469 and #224 and likely avoid similar issues in the future.The text was updated successfully, but these errors were encountered: