Subject: bin/28751: /usr/bin/w dynamic sizing of FROM column problems
To: None <,>
From: None <>
List: netbsd-bugs
Date: 12/22/2004 08:21:00
>Number:         28751
>Category:       bin
>Synopsis:       /usr/bin/w dynamic sizing of FROM column problems
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 22 08:21:00 +0000 2004
>Originator:     Ed Ravin
>Release:        2.0
NetBSD 2.0 NetBSD 2.0 (PANIX-USER) #0: Fri Dec 17 22:40:30 EST 2004 i386

we have three identical machines - on one of them, /usr/bin/w output is oddly formatted, with each line 88 characters long on an 80 column terminal.  Note the user logged in from a very long hostname - I suspect something is going on with w's attempts to dynamically size the output based on the size of the hostname in utmpx.  I don't fully grok the code in w.c, but it doesn't seem to check for things like a 256 character hostname.

Also, unlike /usr/bin/last, there are no command-line options to adjust how much hostname output you want.

 1:40PM  up 3 days, 13:21, 123 users, load averages: 0.83, 1.78, 3.01
USER    TTY FROM                                                   LOGIN@  IDLE WHAT
drewc    p0                                           9:51AM  1:07 -tcsh 
dn       p1                               1:08PM     0 /usr/lo 
kerausch p2                                        8:42AM    34 -bash 
mikhail  p3                                             8:54AM    59 -zsh 
ahall    p4                                          7:39AM    27 emacs - 
mappel   p5 Sat12AM    15 pine -i 

Dunno.  Here are the three hostnames that might be provoking the bug:

I note that the 2nd one above is exactly the size of the FROM field
output by w.  But when I tried faking that hostname on a test box in
/etc/hosts, I couldn't reproduce the abberant behavior with the 88-column output.