NetBSD Problem Report #254
From gnats Fri May 20 01:45:49 1994
Received: from gandalf.bbb.no (root@gandalf.bbb.no [192.124.156.194]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id BAA01467 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Fri, 20 May 1994 01:45:35 -0700
Message-Id: <199405200814.KAA06154@gandalf.bbb.no>
Date: Fri, 20 May 1994 10:14:58 +0200
From: Thorsten Lockert <tholo@SigmaSoft.COM>
Reply-To: tholo@SigmaSoft.COM
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: uname(1) output breaks scripts, is unreadable
X-Send-Pr-Version: 3.2
>Number: 254
>Category: lib
>Synopsis: The uname(2) emulation used by uname(1) could use improvement
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 20 06:35:03 +0000 1994
>Closed-Date: Sat May 21 01:20:13 +0000 1994
>Last-Modified:
>Originator: Thorsten Lockert
>Release:
>Organization:
Thorsten Lockert | postmaster@bbb.no |
Postbox 435 | hostmaster@bbb.no | Universe, n.:
N-5001 Bergen | tholo@bbb.no | The problem.
Norway | tholo@sigmasoft.com |
>Environment:
System: NetBSD gandalf.bbb.no NetBSD 0.9B NetBSD 0.9B (GANDALF) #3: Wed May 18 20:04:22 MET DST 1994 tholo@gandalf.bbb.no:/usr/src/sys/arch/i386/compile/GANDALF i386
>Description:
It would be better if the uname(2) emulation (now uname(3)) would
return fields like "NetBSD" "node.domain", "0.9B", "199103" and "i386".
That is, use the sysctl fields "kern.ostype", "kern.hostname",
"kern.osrelease", "kern.osrevision" and "hw.machine" fields, and
remove the "NetBSD " part from the "kern.osrelease" field as generated
by /sys/conf/newvers.sh. This would again make uname(1) usable by
configuration scripts. If you want uname(1) to be able to give the full
config version like above, would it not be better to add that as a new
option to uname(1) or just use sysctl(1) to get at it?
At the very least, the "version" field should not re-specify "NetBSD ",
but only give the version, both for the uname(2) emulation and as a
return on "sysctl kern.osrelease".
>How-To-Repeat:
Run "uname -a"
>Fix:
--- src/sys/conf/newvers.sh.orig Fri May 20 10:07:12 1994
+++ src/sys/conf/newvers.sh Fri May 20 10:07:25 1994
@@ -44,7 +44,7 @@
id=`basename ${d}`
ost="NetBSD"
-osr="${ost} 0.9B"
+osr="0.9B"
echo "char ostype[] = \"${ost}\";" > vers.c
echo "char osrelease[] = \"${osr}\";" >> vers.c
--- src/lib/libc/gen/uname.c.orig Fri May 20 10:07:44 1994
+++ src/lib/libc/gen/uname.c Fri May 20 10:08:25 1994
@@ -69,18 +69,10 @@
/* The version may have newlines in it, turn them into spaces. */
mib[0] = CTL_KERN;
- mib[1] = KERN_VERSION;
+ mib[1] = KERN_OSREVISION;
len = sizeof(name->version);
if (sysctl(mib, 2, &name->version, &len, NULL, 0) == -1)
rval = -1;
- else
- for (p = name->version; len--; ++p)
- if (*p == '\n' || *p == '\t')
- if (len > 1)
- *p = ' ';
- else
- *p = '\0';
-
mib[0] = CTL_HW;
mib[1] = HW_MACHINE;
len = sizeof(name->machine);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: cgd
State-Changed-When: Fri May 20 18:20:13 PDT 1994
State-Changed-Why:
not a bug.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.