From owner-freebsd-bugs@FreeBSD.ORG Tue Aug 25 14:54:01 2009 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0C99106568B; Tue, 25 Aug 2009 14:54:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx06.syd.optusnet.com.au (fallbackmx06.syd.optusnet.com.au [211.29.132.8]) by mx1.freebsd.org (Postfix) with ESMTP id 6F88D8FC25; Tue, 25 Aug 2009 14:54:01 +0000 (UTC) Received: from mail04.syd.optusnet.com.au (mail04.syd.optusnet.com.au [211.29.132.185]) by fallbackmx06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7PCoinY001536; Tue, 25 Aug 2009 22:50:44 +1000 Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail04.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7PCof2E010892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Aug 2009 22:50:42 +1000 Date: Tue, 25 Aug 2009 22:50:41 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: brian@FreeBSD.org In-Reply-To: <200908250803.n7P8373T068548@freefall.freebsd.org> Message-ID: <20090825224356.L40693@delplex.bde.org> References: <200908250803.n7P8373T068548@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-bugs@FreeBSD.org, rivanr@gmail.com Subject: Re: bin/137647: ps(1) output depends on terminals column width when piping or redirecting X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 14:54:02 -0000 On Tue, 25 Aug 2009 brian@FreeBSD.org wrote: > Synopsis: ps(1) output depends on terminals column width when piping or redirecting > > State-Changed-From-To: open->closed > State-Changed-By: brian > State-Changed-When: Tue Aug 25 07:56:45 UTC 2009 > State-Changed-Why: > I agree with Michael. ps(1) checks stdout, stderr then stdin to see if > it's a tty, and if none are will set the width to 79. > > Scripts should either use pgrep or pkill, or else use ps -ww and also > possibly -o comm or -o command. Er, don't you agree with me? I sent a long reply, including to bug-followup, but it isn't in the PR followup :-(. Summary: (1) checking stdin is bogus and is what causes this problem, but I can't see a better way to handle cases like "ps | less" where the output is redirected but the final output is still to a tty. (2) handling of widths is mostly broken, starting with it mostly only applying to the last field. Bruce