Bug 126858

Summary: Too long /proc/X/cmdline: bad ps output when piped to less/more
Product: Red Hat Enterprise Linux 3 Reporter: giulioo
Component: telnetAssignee: Harald Hoyer <harald>
Status: CLOSED ERRATA QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-28 19:49:14 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 giulioo 2004-06-28 14:23:32 UTC
Description of problem:
It seems that telnetd/setproctitle.c sets up a string long as args +
environment, then it proceeds to fill with blanks what's after the
last useful chars (ie: hostname).

The primary effect of this is that /proc/X/cmdline has many blanks at
the end (espacially if you have a bing environment)

The side effect of this is that when you do "ps ax|less", "ps ax|more"
(but not simple "ps ax" or "ps ax > file") output will look like

Version-Release number of selected component (if applicable):
telnet-server-0.17-26


How reproducible:
Always


Steps to Reproduce:
1. "ps ax|less"
2. look at the output

Actual Results (blank lines in output): 
========
 1117 ?        SW     0:00 [kjournald]
13127 ?        S      0:00 in.telnetd: myhost
 
 
 
13128 ?        S      0:00 login -- mylogin
=========

Expected Results: 
=========
 1117 ?        SW     0:00 [kjournald]
13127 ?        S      0:00 in.telnetd: myhost
13128 ?        S      0:00 login -- mylogin
==========


Additional info:

Possible solution (the one involving minimal code modification):

--- telnetd/setproctitle.c.orig 2004-06-24 19:47:44.000000000 +0200
+++ telnetd/setproctitle.c      2004-06-24 19:47:56.000000000 +0200
@@ -139,7 +139,7 @@
        (void) strcpy(Argv[0], buf);
        p = &Argv[0][i];
        while (p < LastArgv)
-               *p++ = ' ';
+               *p++ = '\0';
        Argv[1] = NULL;
 }

Comment 1 Harald Hoyer 2004-06-28 14:53:28 UTC
good point! Thx!

Comment 2 Josh Bressers 2005-03-28 19:49:14 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2005-327.html