Bug 25855

Summary: /bin/ps issue when output isn't to a tty
Product: Base System Reporter: fracture <fracture>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.2-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description fracture 2001-03-16 20:10:01 UTC
	When the output from /bin/ps is piped to another program, it limits it's output to
	a width of 79 cols.  This causes problems with commands such as:
	ps aux | grep httpd
	because if the httpd part is past the 79 col mark, the grep wont find it.  right
	now the way around this is to use
	ps wwaux | grep httpd
	but it doesn't make sense to have to specify terminal "width" if the output isn't to
	a terminal

Fix: this checks if the stdout is a tty before limiting the cols used
How-To-Repeat: 
	easiest way to repeat is to use the -e options so nothing will manage to be in the
	<79 cols for the grep to read it.  so for instance:
	# ps eaxu | grep getty
	will not show anything.
Comment 1 Peter Pentchev 2001-03-16 20:14:26 UTC
I don't really think this would be such a good idea; does ps already
do something different when stdout is not a terminal?  If not, wouldn't
this be an (arguably minor) POLA violation?

G'luck,
Peter

-- 
This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain.

On Fri, Mar 16, 2001 at 12:51:56PM +0000, fracture@allusion.net wrote:
> 
> >Number:         25855
> >Category:       bin
> >Synopsis:       /bin/ps issue when output isn't to a tty
> >Originator:     Jordan DeLong
> >Release:        FreeBSD 4.2-RELEASE i386
> >Organization:
> N/A
> >Environment:
> 
> 	N/A
> 	
> >Description:
> 
> 	When the output from /bin/ps is piped to another program, it limits it's output to
> 	a width of 79 cols.  This causes problems with commands such as:
> 	ps aux | grep httpd
> 	because if the httpd part is past the 79 col mark, the grep wont find it.  right
> 	now the way around this is to use
> 	ps wwaux | grep httpd
> 	but it doesn't make sense to have to specify terminal "width" if the output isn't to
> 	a terminal
Comment 2 Garrett A. Wollman 2001-03-16 20:50:47 UTC
<<On Fri, 16 Mar 2001 12:51:56 GMT, fracture@allusion.net said:

>now the way around this is to use
>ps wwaux | grep httpd
>but it doesn't make sense to have to specify terminal "width" if the output isn't to
>a terminal

Your fix breaks the case of:

	ps aux | more

-GAWollman
Comment 3 Poul-Henning Kamp freebsd_committer freebsd_triage 2001-03-28 20:07:46 UTC
State Changed
From-To: open->closed

I think the reason for the 'w' option in the first place is 
to disable the default window-width setting. 

As Wollman notes, breaking a very common case would hurt POLA.