w and who can't display bare IPv6 source addresses
Matthew Pounsett
matt at conundrum.com
Thu May 1 21:57:52 UTC 2014
On a FreeBSD 9.2 system, it looks like ‘w’ and ‘who’ have a collection of bugs that conspire to prevent the display of a complete IPv6 address. I’m wondering if there are known workarounds for this, and whether people think this should be one big PR or not…
First off, ‘w -n’ is ignored in all cases (this is true for v4 and v6):
> w -n
9:38PM up 106 days, 22:23, 2 users, load averages: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE WHAT
matt pts/0 2001:4900:1044:0:2808:f1 9:38PM - -tcsh (tcsh)
matt pts/1 kaywinnit.conundrum.com 9:38PM - w -n
One of those logins is from a host with reverse DNS, the other without. That part is a clear bug.
I will also point out that the address without rev DNS is incomplete. This is the other problem… w is not able to readjust for long field lengths. Widening the terminal doesn’t help. And, it seems that ‘w’ doesn’t pay attention to the COLUMNS environment variable defined by environ(7)… at least not for widening the display. This seems like at least a design flaw, if not a bug.
‘who’ can display a whole IPv6 address in its output if you happen to not have reverse DNS. But, who doesn’t implement -n at all, so if an address has reverse DNS, you’re stuck. A full 39-character string representation of an IPv6 address would pad the below line out to exactly 80 columns, so despite the fact that who’s man page says it listens to the COLUMNS environment variable, it doesn’t need to for extending the line .. it would fit into a typical 80-column layout anyway. … if only -n existed. The absence of -n here also seems like a design flaw.
> who
matt pts/0 May 1 21:38 (2001:4900:1044:0:2808:f1c9:e677:5045)
matt pts/1 May 1 21:38 (kaywinnit.conundrum.com)
Does this make sense to anyone else? Should I file a couple PRs about these tools?
More information about the freebsd-questions
mailing list