Bug 126858 - Too long /proc/X/cmdline: bad ps output when piped to less/more
Too long /proc/X/cmdline: bad ps output when piped to less/more
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: telnet (Show other bugs)
3.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Harald Hoyer
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-06-28 10:23 EDT by giulioo
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-28 14:49:14 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description giulioo 2004-06-28 10:23:32 EDT
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 10:53:28 EDT
good point! Thx!
Comment 2 Josh Bressers 2005-03-28 14:49:14 EST
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

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