Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 May 2003 18:19:48 +0200 (CEST)
From:      Jilles Tjoelker <jilles@stack.nl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   bin/52489: [PATCH] ps tpt does not work
Message-ID:  <20030520161948.1AAEF9A@toad.stack.nl>
Resent-Message-ID: <200305201620.h4KGK88H087433@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         52489
>Category:       bin
>Synopsis:       [PATCH] ps tpt does not work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 20 09:20:08 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jilles Tjoelker
>Release:        FreeBSD 4.8-RELEASE i386
>Organization:
MCGV Stack
>Environment:
System: FreeBSD xxx.xxx.xxx 4.8-RELEASE FreeBSD 4.8-RELEASE #0: Sat Apr 19 16:05:02 CEST 2003     jilles@xxx.xxx.xxx:/usr/obj/usr/src/sys/JAGUAR  i386

The problem is present on a fairly recent 4.8-STABLE and 5.1-BETA as well.
>Description:
The kludge in ps that changes 't' to 'T' at the end of argv[1] if there is no
minus does not check for a 't' option.

Note that ps Uroot did not work in FreeBSD 4.3-RELEASE, but works in
4.8-RELEASE.
>How-To-Repeat:
$ ps tpt
ps: /dev/ttypT: No such file or directory
>Fix:
Workaround: Use ps -tpt or ps t pt.

A possible fix is below.

--- ps-tkludge.patch begins here ---
--- /usr/src/bin/ps/ps.c.orig	Thu Jul  4 10:30:37 2002
+++ /usr/src/bin/ps/ps.c	Fri May 16 23:07:00 2003
@@ -619,7 +619,7 @@
 	 * option string, the remainder of the string is the argument to
 	 * that flag; do not modify that argument.
 	 */
-	if (strcspn(s, "MNOoU") == len && *cp == 't' && *s != '-')
+	if (strcspn(s, "MNOoUt") >= len - 1 && *cp == 't' && *s != '-')
 		*cp = 'T';
 	else {
 		/*
--- ps-tkludge.patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030520161948.1AAEF9A>