Date: Tue, 25 Aug 2009 22:50:41 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: brian@FreeBSD.org Cc: freebsd-bugs@FreeBSD.org, rivanr@gmail.com Subject: Re: bin/137647: ps(1) output depends on terminals column width when piping or redirecting Message-ID: <20090825224356.L40693@delplex.bde.org> In-Reply-To: <200908250803.n7P8373T068548@freefall.freebsd.org> References: <200908250803.n7P8373T068548@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090825224356.L40693>