Date: Wed, 21 Aug 2019 21:22:30 +0200 From: Gordon Bergling <gbergling@gmail.com> To: "Rodney W. Grimes" <freebsd-rwg@gndrsh.dnsmgr.net> Cc: Ian Lepore <ian@freebsd.org>, freebsd-hackers@freebsd.org Subject: Re: uname -a default options Message-ID: <67A10C58-7A1A-4E8E-A567-6A2AD3E195B1@gmail.com> In-Reply-To: <201908171616.x7HGGhpK036345@gndrsh.dnsmgr.net> References: <201908171616.x7HGGhpK036345@gndrsh.dnsmgr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Rod, after reading the POSIX spec [1] I agree that the default options behind = =E2=80=9E-a" can not be changed. While reading the source of usr.bin/uname/uname.c I recognized that = FreeBSD=E2=80=99s uname is getting its information from sysctl calls. = Can you point me to right direction where in sys/ the sysctl = =E2=80=9Ekern.version=E2=80=9C (KERN_VERSION internally) is set? I would like create a small patch that changes =E2=80=9E-v=E2=80=9C=20 from "FreeBSD 12.0-STABLE r351343 GENERIC=E2=80=9C=20 to =E2=80=9Er351343 GENERIC=E2=80=9C for a further discussion. Kind Regards, Gordon [1] = https://pubs.opengroup.org/onlinepubs/9699919799/utilities/uname.html > Am 17.08.2019 um 18:16 schrieb Rodney W. Grimes = <freebsd-rwg@gndrsh.dnsmgr.net>: >=20 >> On Sat, 2019-08-17 at 15:08 +0200, Gordon Bergling wrote: >>> Hello List, >>>=20 >>> "uname -a" is currently mapping the -a option to ?-mnrsv?, which >>> results in something similar like >>>=20 >>> $ uname -a >>> FreeBSD lion.0xfce3.net <http://lion.0xfce3.net/> 12.0-STABLE = FreeBSD >>> 12.0-STABLE r350835 GENERIC amd64 >>>=20 >>> What would you think about reducing the option mapping for ?-a? to = ?- >>> vmn? , which would result in a less repetitive version string like >>> the one below. >>>=20 >>> $ uname -vmn >>> lion.0xfce3.net <http://lion.0xfce3.net/> FreeBSD 12.0-STABLE = r350835 >>> GENERIC amd64 >>>=20 >>> Adapting this would be trivial, but before I hack something = together, >>> I would like to get some feedback if such a change would be = welcomed? >>>=20 >>> Best regards, >>>=20 >>> Gordon >>>=20 >>=20 >> I think there are likely very many existing scripts in the world that >> parse the output of uname -a and would break if the fields moved = around >> or disappeared. >=20 > I agree that we should not change the output of uname -a, for one > it is a POSIX spec'ed command, though I would not expect scripts > to be parsing the output of -a, they should actually invoke the > more specific item(s) they need and parse those, a much less error > prone methods. >=20 > I would however like to note that Linux (or atleast Ubuntu 19.04) > has a man page that -a says "All of the below" and are infact = returning > more info than the Posix man page which says -a is -mnrsv >=20 > rgrimes@mgmt:~$ uname -a > Linux mgmt 5.1.0-rc2+ #14 SMP Sun Aug 4 09:23:12 UTC 2019 x86_64 = x86_64 x86_64 GNU/Linux > rgrimes@mgmt:~$ man uname > rgrimes@mgmt:~$ uname -mnrsv > Linux mgmt 5.1.0-rc2+ #14 SMP Sun Aug 4 09:23:12 UTC 2019 x86_64 > rgrimes@mgmt:~$ uname -m > x86_64 > rgrimes@mgmt:~$ uname -n > mgmt > rgrimes@mgmt:~$ uname -r > 5.1.0-rc2+ > rgrimes@mgmt:~$ uname -s > Linux > rgrimes@mgmt:~$ uname -v > #14 SMP Sun Aug 4 09:23:12 UTC 2019 >=20 > FreeBSD: > root {1003}# uname -a > FreeBSD w530a.dnsmgr.net 12.0-RELEASE FreeBSD 12.0-RELEASE r341666 = GENERIC amd64 > root {1004}# uname -m > amd64 > root {1005}# uname -n > w530a.dnsmgr.net > root {1006}# uname -r > 12.0-RELEASE > root {1007}# uname -s > FreeBSD > root {1008}# uname -v > FreeBSD 12.0-RELEASE r341666 GENERIC=20 >=20 > So it is really our -v string that is full of redundant > data that MAY want to be evaluated for trimming. >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67A10C58-7A1A-4E8E-A567-6A2AD3E195B1>