Subject: Re: /usr/bin/w dumps core on mips
To: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
From: Simon Burge <simonb@netbsd.org>
List: port-mips
Date: 07/26/2000 00:19:58
Izumi Tsutsui wrote:
> 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)
What are the users logged in? "tsutsui" certainly shouldn't cause
problems. What does "print *ep->kp" show (I think that's right)? The
ep->kp->p_login field should be properly null terminated in all cases.
I don't have my -current pmax up at the moment, but I have no problems
with alpha, i386 (and someone else has tested sparc)...
Simon.
> 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