Bug 692995 - procps: Regarding FROM field in "w" command
Summary: procps: Regarding FROM field in "w" command
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: procps
Version: 14
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Jan Görig
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-04-01 22:08 UTC by Navdeep Bhatia
Modified: 2011-05-10 03:30 UTC (History)
2 users (show)

Fixed In Version: procps-3.2.8-19.20110302git.fc15
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-05-10 03:30:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.