Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2018 18:03:35 -0800
From:      Cy Schubert <Cy.Schubert@cschubert.com>
To:        mike@karels.net
Cc:        arch@freebsd.org
Subject:   Re: ps output line length change
Message-ID:  <201802170203.w1H23ZTE023044@slippy.cwsent.com>
In-Reply-To: Message from Mike Karels <mike@karels.net> of "Fri, 16 Feb 2018 18:46:57 -0600." <201802170046.w1H0kvxN032252@mail.karels.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <201802170046.w1H0kvxN032252@mail.karels.net>, Mike Karels 
writes:
> A couple of weeks ago, I sent email on the committers list proposing
> reversion of r314685 changing the output line length for ps.  In
> particular, it uses unlimited line length if stdout is not a tty.
> The previous code used the tty width if any of stdout, stderr, or
> stdin was a tty.  The change in r314685 has not been shipped in
> any release yet.
>
> The responses to that email all agreed with reversion.  However, there
> has been some additional discussion in private email.  Therefore, I
> am sending this to arch@.
>
> My reasoning is this;
>
> 1. The output line length for the following commands should reasonably
> be the same in an interactive session: ps, ps | more, ps | grep.
>
> 2. The previous behavior is the way things have worked since 1990,
> as Conrad pointed out.  As others pointed out, it has long been known
> that -ww was required to get unlimited lines, e.g. in a script.  I
> don't see any significant justification to change 28 years of precedent.
>
> 3. The rationale for the change included that it is easier for scripts
> (which I maintain are broken if they assume this), and that it doesn't
> matter if using less with left-right scrolling.  We shouldn't make
> assumptions about what the output is going through, let alone assume
> left-right scrolling.  The previous algorithm was described as magic,
> but I think it is straightforward.  Perhaps a comment is in order.
>
> I tried to think of a compromise solution, but the only thing that
> comes to mind is messy: an environment variable that would enable
> unlimited line length when the output was not a tty.  That would not
> be easier for scripts.  And as Bruce noted, aliasing ps to "ps -ww"
> does not work with old BSD-stype "ps axu".

Agreed. I also agree scripts that expect wide output without ww are 
broken. However Linux ps, at least Red Hat, behaves the same. I believe 
the change was made to be more Linux compatible and allow greater 
portability.

>
> What do people think should be done?

That's a tough one. Break Linux compatibility or break BSD 
compatibility?

Generally Linux users use ps -ef which we don't support and columns are 
different so, Linux compatibility is... well just isn't.

My vote is to revert and have an environment variable with defaults, 
e.g., PS=--linux or something similar.


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  http://www.FreeBSD.org

	The need of the many outweighs the greed of the few.





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