Subject: bin/7506: ps output format fails for -j (blame SESS)
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mason@primenet.com.au>
List: netbsd-bugs
Date: 05/01/1999 12:54:08
>Number:         7506
>Category:       bin
>Synopsis:       ps output format fails with SESS (as used in -j)
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May  1 11:20:01 1999
>Last-Modified:
>Originator:     Geoff C. Wing
>Organization:
Geoff Wing   <gcw@pobox.com>            Mobile : (Australia) 0413 431 874 <<<new
Work URL: http://www.primenet.com.au/   Ego URL: http://pobox.com/~gcw/
>Release:        -current 19990501
>Environment:
System: NetBSD c.primenet.com.au 1.4_BETA NetBSD 1.4_BETA (C) #0: Sat Apr 24 17:43:25 EST 1999 mason@c.primenet.com.au:/usr/netbsd/src/sys/arch/i386/compile/C i386


>Description:
	% ps -j
	USER       PID  PPID  PGID   SESS JOBC STAT TT       TIME COMMAND
	mason    20092   362   362 f05563c0    0 S    ??    0:00.82 /usr/X11R6
	......                                                              *
	where ``*'' is the last column on the screen so ``6'' wraps.  The
	last two letters shouldn't be shown and given how it doesn't line
	up with the headers it's easy to see there's a formatting error
	which is out by two columns, and "SESS" looks like the culprit.

	Looking through formating code indicates session is 6 chars wide.
	Strange since 32 bits printed in hexadecimal are 8 chars wide.

>How-To-Repeat:
	see above.
>Fix:

*** /usr/src/bin/ps/keyword.c	Wed Feb 18 23:06:12 1998
--- /obj/src/bin/ps/keyword.c	Sun May  2 04:03:47 1999
***************
*** 149,155 ****
  	{"rsz", "RSZ", NULL, 0, rssize, 4},
  	UID("ruid", "RUID", evar, EOFF(e_pcred.p_ruid)),
  	{"ruser", "RUSER", NULL, LJUST, runame, USERLEN},
! 	{"sess", "SESS", NULL, 0, evar, 6, EOFF(e_sess), KPTR, "x"},
  	PID("sid", "SID", evar, EOFF(e_sid)),
  	{"sig", "PENDING", NULL, 0, pvar, 8, POFF(p_siglist), INT, "x"},
  	{"sigcatch", "CAUGHT", NULL, 0, pvar, 8, POFF(p_sigcatch), UINT, "x"},
--- 149,155 ----
  	{"rsz", "RSZ", NULL, 0, rssize, 4},
  	UID("ruid", "RUID", evar, EOFF(e_pcred.p_ruid)),
  	{"ruser", "RUSER", NULL, LJUST, runame, USERLEN},
! 	{"sess", "SESS", NULL, 0, evar, 8, EOFF(e_sess), KPTR, "x"},
  	PID("sid", "SID", evar, EOFF(e_sid)),
  	{"sig", "PENDING", NULL, 0, pvar, 8, POFF(p_siglist), INT, "x"},
  	{"sigcatch", "CAUGHT", NULL, 0, pvar, 8, POFF(p_sigcatch), UINT, "x"},
>Audit-Trail:
>Unformatted: