Deprecating ps(1)s -w switch
Dag-Erling Smørgrav
des at des.no
Thu Aug 27 10:28:32 UTC 2009
Brian Somers <brian at FreeBSD.org> writes:
> To clarify, my proposal is to silently ignore the -w switch (any/all of them)
> and to remove the code that reads the terminal width and truncates some
> columns based on the result (or based on "132").
>
> The pros:
>
> - ps's code becomes simpler. It was mentioned that the ps code is
> a minefield. This would remove a few mines.
Frankly, the width limiting code is the least of ps's problems.
> - ps IMHO has no business knowing about terminal widths (and where
> did the 132 column -w idea come from again?). Some programs such
> as iostat have similar (but way more broken) behaviour however whilst
> others such as ls do not.
Actually, ls does pretty much the same thing (use a different layout
when run on a tty), and it's far from the only Unix utility to do so.
Usually, the tty layout is "pretty" while the non-tty layout is easier
to work with in scripts.
> The cons:
> [...]
> - Scripts may exist that depend on the behaviour without -w. Furthermore
> having to handle ps from both before and after such a change in one
> script can be painful.
Breaking existing scripts would be an *extremely* unwise and unpopular
move.
The only part of your proposal I support is removing the 132-column
limit on 'ps -w' (which I believe would make the output from 'ps -w'
identical to that from 'ps -ww')
DES
--
Dag-Erling Smørgrav - des at des.no
More information about the freebsd-hackers
mailing list