[procps] Re: "w --from" broken or new feature?

  • From: Jaromir Capik <jcapik@xxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Tue, 24 Apr 2012 13:04:54 -0400 (EDT)

> Hi guys.
> 
> One question.
> The "w --from" behavior changed somewhere between 3.3.2 and HEAD,
> so that it prints an extra dash at the end of the field.
> 
> Previously the FROM field contained the following in my case:
> :0.0
> localhost
> 
> And now it contains the following:
> :0.0-
> localhost-
> 
> Is that intentional or not?

I quickly analysed the source and found, that the change
is intentional but still needs some tuning.

In my case there are null terminated strings and the zero char
needs to be really handled as the string terminator. I don't know
if any cases where the string is padded with spaces and missing the
null terminator exist.

Anyway ... I fixed that by the following change
------
        for (; host < last; host++) {
+               if (*host == '\0') break;
                if (isprint(*host) && *host != ' ') {
------
and it started working correctly again.

Anyway ... I'm just trying to reincarnate one of the forgotten features
I tried to implement in the past (IP addresses instead of hostnames)
and I'm gonna fix that together with this old/new feature.
This time empty IP address is not displayed (fallback to hostname)
and the display part from the host is concatenated with the IP.
I'll let you know once it's done.

Regards,
Jaromir.


> 
> Thanks,
> Jaromir.
> 
> 
> --
> Jaromir Capik
> Red Hat Czech, s.r.o.
> Software Engineer / BaseOS
> 
> Email: jcapik@xxxxxxxxxx
> Web: www.cz.redhat.com
> Red Hat Czech s.r.o., Purkynova 99/71, 612 45, Brno, Czech Republic
> IC: 27690016
> 
> 
> 
> 

Other related posts: