Subject: /usr/bin/w dumps core on mips
To: None <port-mips@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-mips
Date: 07/25/2000 23:08:36
I notice 1.5_ALPHA /usr/bin/w dumps core on both pmax and newsmips:

---
% ./w
10:24PM  up 20 mins, 2 users, load averages: 0.12, 0.16, 0.19
USER   TTY FROM              LOGIN@  IDLE WHAT
Segmentation fault (core dumped)
proudia-% gdb w w.core
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "mipsel--netbsd"...
Core was generated by `w'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.elf_so...done.
Reading symbols from /usr/lib/libkvm.so.5...done.
Reading symbols from /usr/lib/libc.so.12...done.
#0  0x200fb734 in strlen () at /usr/src/lib/libc/arch/mips/string/strlen.S:1
1	/*		$NetBSD: strlen.S,v 1.5 1996/09/17 01:32:36 jonathan Exp $	*/
(gdb) 
---

Is the following patch correct?

--- w.c.orig	Tue Jul 25 22:50:34 2000
+++ w.c	Tue Jul 25 22:50:40 2000
@@ -319,8 +319,8 @@
 			    (int)(ep->utmp.ut_host + UT_HOSTSIZE - x), x);
 			p = buf;
 		}
-		(void)printf("%-*s %-2.2s %-*.*s ",
-		    lognamelen, ep->kp->p_login,
+		(void)printf("%-*.*s %-2.2s %-*.*s ",
+		    lognamelen, lognamelen, ep->kp->p_login,
 		    (strncmp(ep->utmp.ut_line, "tty", 3) &&
 		    strncmp(ep->utmp.ut_line, "dty", 3)) ?
 		    ep->utmp.ut_line : ep->utmp.ut_line + 3,

---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp