Bug 126858 - Too long /proc/X/cmdline: bad ps output when piped to less/more
Summary: Too long /proc/X/cmdline: bad ps output when piped to less/more
Alias: None
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: telnet (Show other bugs)
(Show other bugs)
Version: 3.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Harald Hoyer
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2004-06-28 14:23 UTC by giulioo
Modified: 2007-11-30 22:07 UTC (History)
0 users

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

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2005:327 important SHIPPED_LIVE Important: telnet security update 2005-03-28 05:00:00 UTC

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):

How reproducible:

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.


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