uname vs /etc/os-release

Eli Schwartz eschwartz at archlinux.org
Thu Nov 15 01:54:56 UTC 2018


On 11/14/18 7:10 PM, Bernd Petrovitsch wrote:
> On 14/11/2018 19:26, James Hanley wrote:
>> uname doesn't (appear to) do it now, but should it extract information
>> from /etc/os-release for rendering?
> 
> Why should it? What are you missing? Please bring something serious and
> not just a wish/claim/..... Thank you.
> 
> In fact:
> - /etc/os-release is just a text file in the filesystem which seems to
>   contains some information about the installed distribution (and I
>   don't if it exists outside of the Linux world).

I'm fairly confident it does not exist outside of the Linux world. It's
a Freedesktop.org specification pushed by the developers of systemd.

If you know what non-Linux operating system you're using, then any
possible information you might want to find out will have one canonical
way to find it out, which I believe is usually by using `uname -r` as
the operating system version instead of the Linux kernel version...

> - The `uname` binary (as in `man 1 uname`) uses the uname() sys-call (as
>   in `man 2 uname`) - `strace` it and see for yourself (and why didn't
>   you do this before?).
> 
> MfG,
> 	Bernd

The -o flag does indeed print a compile-time macro that does not come
from the uname() syscall, which for busybox is set in
CONFIG_UNAME_OSNAME, and for GNU coreutils is set via an autotools macro.

But you're correct in your main point which is that it has no useful
information.

As the help text for both uname executables indicates, it is the
*operating system* name. As you pointed out, /etc/os-release does not
contain the operating system name, it assumes the operating system is
already Linux, then provides information about which distributor
provided the specific compilation of the "Linux" operating system.

It would break the spec for the uname command to provide information
other than the operating system. This is independent of whether it uses
the uname() syscall to obtain the info.

...

I think the problem here is that many people are confused about what a
*distribution* of the "Linux operating system" is, and think that
different distributions are actually different operating systems to the
same degree that Windows and Linux and macOS and Solaris and the
different *BSDs etc. are different operating systems.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20181114/bf0eabaa/attachment.asc>


More information about the busybox mailing list