Subject: bin/8401: rwho only sorts first 8 chars of hostnames
To: None <gnats-bugs@gnats.netbsd.org>
From: None <John.P.Darrow@wheaton.edu>
List: netbsd-bugs
Date: 09/13/1999 16:01:50
>Number: 8401
>Category: bin
>Synopsis: rwho only sorts first 8 chars of hostnames
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Sep 13 15:50:01 1999
>Last-Modified:
>Originator: John Darrow
>Organization:
Computing Services
Wheaton College, Wheaton, IL
>Release: 1.4* and current through 19990913
>Environment:
System: NetBSD jdarrowp5.wheaton.edu 1.4K NetBSD 1.4K (JDARROWP5) #0: Mon Sep 13 16:20:10 CDT 1999 jdarrow@jdarrowp5.wheaton.edu:/var/src/sys/arch/i386/compile/JDARROWP5 i386
>Description:
/usr/include/protocols/rwhod.h declares wd_hostname as char[32].
However, rwho only sorts on the first 8 characters. This results
in the rwho output for machines with similar hostnames being sorted
in a rather surprising way...
>How-To-Repeat:
run rwho with same user logged onto machines with hostnames which
only differ after first 8 characters, see intermingled hostnames:
jdarrow jdarrowppp:tty02 Sep 12 03:20 :04
jdarrow jdarrowpiii:ttyp1 Sep 13 16:52 :22
jdarrow jdarrowp5:ttyp1 Sep 13 16:54
jdarrow jdarrowp5:ttyp2 Sep 13 16:54 :08
jdarrow jdarrowpiii:ttyp2 Sep 13 16:52 :07
jdarrow jdarrowp5:ttyp3 Sep 13 16:55 :06
jdarrow jdarrowpiii:ttyp3 Sep 13 16:52 :06
jdarrow jdarrowp5:ttyp4 Sep 13 16:55 :08
jdarrow jdarrowpiii:ttyp4 Sep 13 16:52 :07
jdarrow jdarrowp5:ttyp5 Sep 13 16:55 :06
jdarrow jdarrowpiii:ttyp5 Sep 13 16:52 :03
>Fix:
Index: rwho.c
===================================================================
RCS file: /source/cvs/netbsd/current/src/usr.bin/rwho/rwho.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 rwho.c
--- rwho.c 1999/01/18 21:19:36 1.1.1.2
+++ rwho.c 1999/09/13 22:07:34
@@ -196,7 +196,7 @@
rc = strncmp(u1->myutmp.out_name, u2->myutmp.out_name, 8);
if (rc)
return (rc);
- rc = strncmp(u1->myhost, u2->myhost, 8);
+ rc = strncmp(u1->myhost, u2->myhost, 32);
if (rc)
return (rc);
return (strncmp(u1->myutmp.out_line, u2->myutmp.out_line, 8));
P.S. to whoever looks at this pr: please, if possible, also add the
following workaround to src/usr.bin/rwho/Makefile until the egcs bug in
pr port-i386/8364 is fixed:
Index: /source/NetBSD-current/src/usr.bin/rwho/Makefile
===================================================================
RCS file: /source/cvs/netbsd/current/src/usr.bin/rwho/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- Makefile 1999/01/17 15:56:06 1.1.1.1
+++ Makefile 1999/03/28 21:43:29 1.3
@@ -3,4 +3,8 @@
PROG= rwho
+.if (${MACHINE_ARCH} == "i386")
+CFLAGS= -O # work around bug in egcs
+.endif
+
.include <bsd.prog.mk>
>Audit-Trail:
>Unformatted: