From j@bug.fe.up.pt  Thu Dec 18 10:16:03 1997
Received: from bug.fe.up.pt (bug.fe.up.pt [193.136.54.1])
          by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id KAA09602
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 18 Dec 1997 10:16:01 -0800 (PST)
          (envelope-from j@bug.fe.up.pt)
Received: (from j@localhost)
	by bug.fe.up.pt (8.8.8/8.8.8) id SAA05059;
	Thu, 18 Dec 1997 18:15:48 GMT
	(envelope-from j)
Message-Id: <199712181815.SAA05059@bug.fe.up.pt>
Date: Thu, 18 Dec 1997 18:15:48 GMT
From: j@bug.fe.up.pt
Reply-To: j@bug.fe.up.pt
To: FreeBSD-gnats-submit@freebsd.org
Subject: /usr/bin/ps does not work as expected
X-Send-Pr-Version: 3.2

>Number:         5340
>Category:       docs
>Synopsis:       ps manpage needs updated.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-doc
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 18 10:20:00 PST 1997
>Closed-Date:    Wed Jun 3 23:41:22 PDT 1998
>Last-Modified:  Wed Jun  3 23:46:43 PDT 1998
>Originator:     Jorge Goncalves
>Release:        FreeBSD 2.2-971214-SNAP i386
>Organization:
>Environment:

All FreeBSD releases as I know. 

>Description:

The ps program does not show 'co' when programs are running in the console
but it shows 'con' and the man page states:

     tt      An abbreviation for the pathname of the controlling terminal, if
             any.  The abbreviation consists of the two letters following
             ``/dev/tty'', or, for the console, ``co''.  This is followed by a
             ``-'' if the process can no longer reach that controlling termi-
             nal (i.e., it has been revoked).

>How-To-Repeat:

Some programs run using the console like squid, but it might also be 
recreated by running at getty on the console (change /etc/ttys):

	console "/usr/libexec/getty Pc"         cons25  on  secure

and then logging in using that virtual console ans issuing a ps:

  PID  TT  STAT      TIME COMMAND
  219  con Is     0:00.24 -tcsh (tcsh)

>Fix:
	
I am including a patch that corrects the problem. Hey, core team members,
apply this patch or change the code to behave as it is reported by the 
man page.

--- bin/ps/print.c.orig Thu Dec 18 17:26:37 1997
+++ bin/ps/print.c      Thu Dec 18 17:38:28 1997
@@ -337,8 +337,8 @@
        else {
                if (strncmp(ttname, "tty", 3) == 0 ||
                    strncmp(ttname, "cua", 3) == 0)
-                       ttname += 3;
-               (void)printf("%*.*s%c", v->width-1, v->width-1, ttname,
+                       ttname += 3; 
+               (void)printf(" %*.*s%c", v->width-2, v->width-2, ttname,
                        KI_EPROC(k)->e_flag & EPROC_CTTY ? ' ' : '-');
        }
 }

>Release-Note:
>Audit-Trail:

From: "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To: j@bug.fe.up.pt
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/5340: /usr/bin/ps does not work as expected
Date: Fri, 19 Dec 1997 12:14:22 +1100 (EST)

 > 
 >      tt      An abbreviation for the pathname of the controlling terminal, if
 >              any.  The abbreviation consists of the two letters following
 >              ``/dev/tty'', or, for the console, ``co''.  This is followed by a
 >              ``-'' if the process can no longer reach that controlling termi-
 >              nal (i.e., it has been revoked).
 
 This is an error in the man page, as some devices, such as Cyclades 
 serial ttys have three characters.  e.g. /dev/ttyc00, /dev/cuac00
 
 Danny
State-Changed-From-To: open->analyzed 
State-Changed-By: phk 
State-Changed-When: Thu Apr 30 13:11:29 PDT 1998 
State-Changed-Why:  
analyzed 


Responsible-Changed-From-To: freebsd-bugs->doc 
Responsible-Changed-By: phk 
Responsible-Changed-When: Thu Apr 30 13:11:29 PDT 1998 
Responsible-Changed-Why:  
doc issue 
Responsible-Changed-From-To: doc->freebsd-doc 
Responsible-Changed-By: steve 
Responsible-Changed-When: Tue May 5 07:01:33 PDT 1998 
Responsible-Changed-Why:  
Belongs to freebsd-doc. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: jkoshy 
State-Changed-When: Wed Jun 3 23:41:22 PDT 1998 
State-Changed-Why:  
Fixed in rev 1.18 of "ps.1", thanks! 
>Unformatted:
