Bug 692995

Summary: procps: Regarding FROM field in "w" command
Product: [Fedora] Fedora Reporter: Navdeep Bhatia <navdeep>
Component: procpsAssignee: Jan Görig <jgorig>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: jgorig, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: procps-3.2.8-19.20110302git.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-10 03:30:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Navdeep Bhatia 2011-04-01 22:08:08 UTC
Description of problem:

Hi,

The "FROM" field in output of "w" command prints the value of the remote-host. But the output for this field can contain just 16 characters as depicted in the code snippet (taken from w.c, release 3.2.8) below.
This truncates the value in case FROM field is an IPV6 address or a hostname. Is there any specific reason that this is limited to 16 chars only?  


/* This routine is careful since some programs leave utmp strings
 * unprintable.  Always outputs at least 16 chars padded with spaces
 * on the right if necessary.
 */
static void print_host(const char *restrict host, int len) {
    const char *last;
    int width = 0;

    /* FIXME: there should really be a way to configure this... */
    /* for now, we'll just limit it to the 16 that the libc5 version
     * of utmp uses.
     */
    if (len > 16) len = 16;
    last = host + len;
    for ( ; host < last ; host++){
        if (isprint(*host) && *host != ' ') {
            fputc(*host, stdout);
            ++width;
        } else {
            break;
        }
    }
    // space-fill, and a '-' too if needed to ensure the column exists
    if(width < 16) fputs("-               "+width, stdout);
}


This has recently been fixed for debian in procps-3.2.8-2 but is still not available as part of fedora.

Thanks.


Regards,
Navdeep

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Fedora Update System 2011-05-05 09:39:15 UTC
procps-3.2.8-19.20110302git.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/procps-3.2.8-19.20110302git.fc15

Comment 2 Jan Görig 2011-05-05 09:40:00 UTC
Thank you for the bug report. I have modified Debian patch and it is available in update for Fedora 15 and Rawhide.
The length of FROM field is changeable via environment variable PROCPS_FROMLEN now.

I prefer to add this patch only to Fedora 15 and above.

Comment 3 Fedora Update System 2011-05-05 21:52:34 UTC
Package procps-3.2.8-19.20110302git.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing procps-3.2.8-19.20110302git.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/procps-3.2.8-19.20110302git.fc15
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2011-05-10 03:30:42 UTC
procps-3.2.8-19.20110302git.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.