Date: Mon, 6 Mar 2017 20:11:31 -0800 From: Bryan Drewery <bdrewery@FreeBSD.org> To: Conrad Meyer <cem@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314685 - head/bin/ps Message-ID: <01dddec8-89c0-e18a-a481-e802643f9e0e@FreeBSD.org> In-Reply-To: <201703042238.v24McAD8008837@repo.freebsd.org> References: <201703042238.v24McAD8008837@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --up7CmC8UErl3C1ts7tV7q9B45s4Ejl54E Content-Type: multipart/mixed; boundary="CuUcadL6ajKhjO0sj0Hxtk5uDKlRqp8fC"; protected-headers="v1" From: Bryan Drewery <bdrewery@FreeBSD.org> To: Conrad Meyer <cem@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <01dddec8-89c0-e18a-a481-e802643f9e0e@FreeBSD.org> Subject: Re: svn commit: r314685 - head/bin/ps References: <201703042238.v24McAD8008837@repo.freebsd.org> In-Reply-To: <201703042238.v24McAD8008837@repo.freebsd.org> --CuUcadL6ajKhjO0sj0Hxtk5uDKlRqp8fC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 3/4/17 2:38 PM, Conrad Meyer wrote: > Author: cem > Date: Sat Mar 4 22:38:10 2017 > New Revision: 314685 > URL: https://svnweb.freebsd.org/changeset/base/314685 >=20 > Log: > ps(1): Only detect terminal width if stdout is a tty > =20 > If stdout isn't a tty, use unlimited width output rather than truncat= ing to > 79 characters. This is helpful for shell scripts or e.g., 'ps | grep= foo'. This change actually makes things worse for me for 'ps uaxwd|less' Before: > nobody 83979 0.0 0.0 9016 1364 3 I+J 20:03 0:00.= 06 | | `-- /usr/bin/make -C /usr/ports/lang/perl5.24 build After: > nobody 89743 0.0 0.0 9016 1368 3 S+J 20:07 0:00.= 05 | | `-- /usr/bin/make -C /usr/ports/lang/perl5.24 I now have to specify -ww to not cut things off, but that's far more than I want to see. > =20 > This hardcoded width has some history: In The Beginning of History[0]= , the > width of ps was hardcoded as 80 bytes. In 1985, Bloom@ added detecti= on > using TIOCGWINSZ on stdin.[1] In 1986, Kirk merged a change to check= > stdout's window size instead. In 1990, the fallback checks to stderr= and > stdin's TIOCGWINSZ were added by Marc@, with the commit message "new > version."[2] > =20 > OS X Darwin has a very similar modification to ps(1), which simply se= ts > UNLIMITED for all non-tty outputs.[3] I've chosen to respect COLUMNS= > instead of behaving identically to Darwin here, but I don't feel stro= ngly > about that. We could match OS X for parity if that is desired. > =20 > [0]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?annotate=3D1065 > [1]: https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=3D18105&r2=3D1810= 6 > [2]: > https://svnweb.freebsd.org/csrg/bin/ps/ps.c?r1=3D40675&r2=3D40674&pat= hrev=3D40675 > [3]: > https://opensource.apple.com/source/adv_cmds/adv_cmds-168/ps/ps.c.aut= o.html > =20 > PR: 217159 > Reported by: Deepak Nagaraj <n.deepak at gmail.com> >=20 > Modified: > head/bin/ps/ps.c >=20 > Modified: head/bin/ps/ps.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/bin/ps/ps.c Sat Mar 4 22:23:59 2017 (r314684) > +++ head/bin/ps/ps.c Sat Mar 4 22:38:10 2017 (r314685) > @@ -194,6 +194,8 @@ main(int argc, char *argv[]) > =20 > if ((cols =3D getenv("COLUMNS")) !=3D NULL && *cols !=3D '\0') > termwidth =3D atoi(cols); > + else if (!isatty(STDOUT_FILENO)) > + termwidth =3D UNLIMITED; > else if ((ioctl(STDOUT_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1 && > ioctl(STDERR_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1 && > ioctl(STDIN_FILENO, TIOCGWINSZ, (char *)&ws) =3D=3D -1) || >=20 --=20 Regards, Bryan Drewery --CuUcadL6ajKhjO0sj0Hxtk5uDKlRqp8fC-- --up7CmC8UErl3C1ts7tV7q9B45s4Ejl54E Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQEcBAEBCgAGBQJYvjL0AAoJEDXXcbtuRpfP+5IH/0QCsQX4BtJgdFD2h5oV8nml bFRxd+O0koTdSlj8RO7M6oQ5oeKb6P8KK+s8iDwJNeF8KGAL3jPc/vgJKO4Ev+ND L5p3pj3Fk2wCNpwlgKyH1gOlHd0nzbw3T7+TyskCYXMhAPw0GTA/ucdNNpdErjWp 7CCRwgkj93l8i4ccq0pJELHO5xBIR+DxDiBwHYLzvRZ8hu74tFzmFdrbkmXW3EQY u/vbhfTOvPweuSxH4hqBxiui5sUZDKb7kA8se6PjRoxnBxDVu5eMKk0f6lr40hp0 2XsXsoUEhplS/+81KNtCzaQRsXWMtqEnyZBI+PI0Ep7cgTp5lrds/HDI93e2mo0= =zKeo -----END PGP SIGNATURE----- --up7CmC8UErl3C1ts7tV7q9B45s4Ejl54E--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?01dddec8-89c0-e18a-a481-e802643f9e0e>