Date: Fri, 28 Jul 2017 18:18:59 +0000 From: Glen Barber <gjb@FreeBSD.org> To: Peter <pmc@citylink.dinoex.sub.org> Cc: freebsd-stable@FreeBSD.ORG, Allan Jude <allanjude@freebsd.org> Subject: Re: 11.1-RELEASE: new line containing garbage added to "top" Message-ID: <20170728181859.GI32551@FreeBSD.org> In-Reply-To: <olfqrk$2eou$1@oper.dinoex.de> References: <olfdv2$17v5$1@oper.dinoex.de> <20170728160436.GE32551@FreeBSD.org> <olfqrk$2eou$1@oper.dinoex.de>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Fri, Jul 28, 2017 at 07:04:51PM +0200, Peter wrote:
> Glen Barber wrote:
> > On Fri, Jul 28, 2017 at 03:24:50PM +0200, Peter wrote:
> > > After upgrading to 11.1-RELEASE, a new line appears in the output of "top"
> > > which contains rubbish:
> > >
> > > > last pid: 10789; load averages: 5.75, 5.19, 3.89 up 0+00:34:46 03:23:51
> > > > 1030 processes:9 running, 1004 sleeping, 17 waiting
> > > > CPU 0: 16.0% user, 0.0% nice, 78.7% system, 4.9% interrupt, 0.4% idle
> > > > CPU 1: 8.0% user, 0.0% nice, 82.5% system, 9.1% interrupt, 0.4% idle
> > > > Mem: 218M Active, 34M Inact, 105M Laundry, 600M Wired, 18M Buf, 34M Free
> > > > ARC: 324M Total, 54M MFU, 129M MRU, 2970K Anon, 13M Header, 125M Other
> > > > 136¿176M Compress185 194M Uncompressed361.94:1 Ratio
> > > > Swap: 2441M Total, 277M Used, 2164M Free, 11% Inuse
> > >
> > > > PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND
> > > ..
> > >
> > >
> > > That looks funny. But I dont like it.
> > >
> >
> > It appears to be fixed in 11-STABLE (r321419).
> >
> > Glen
> >
>
> I don't think so. At least there is nothing in the commitlog. r318449 is the
> last commit in 11-STABLE for the respective file; and thats before the
> 11.1-RELEASE branch.
>
See r321419.
> The error is in the screen-formatting in "top", and that error was already
> present back in 1997 (and probably earlier), and it is also present in HEAD.
>
> What "top" does is basically this:
>
> > char *string = some_buffer_to_print;
> > printf("%.5s", &string[-4]);
>
> A negative index on a string usually yields a nullified area. (Except if
> otherwise *eg*) Thats why we usually don't see the matter - nullbytes are
> invisible on screen.
>
> Fix is very simple:
>
> Index: contrib/top/display.c
> ===================================================================
> --- display.c (revision 321434)
> +++ display.c (working copy)
> @@ -1310,7 +1310,7 @@
> cursor_on_line = Yes;
> putchar(ch);
> *old = ch;
> - lastcol = 1;
> + lastcol++;
> }
> old++;
>
>
> ---------------------------------------------------------
> Then, since I was at it, I decided to beautify the proc display as well, as
> I usually see >1000 procs:
>
>
> --- display.c (revision 321434)
> +++ display.c (working copy)
> @@ -100,7 +100,7 @@
> int y_loadave = 0;
> int x_procstate = 0;
> int y_procstate = 1;
> -int x_brkdn = 15;
> +int x_brkdn = 16;
> int y_brkdn = 1;
> int x_mem = 5;
> int y_mem = 3;
> @@ -373,9 +373,9 @@
> printf("%d processes:", total);
> ltotal = total;
>
> - /* put out enough spaces to get to column 15 */
> + /* put out enough spaces to get to column 16 */
> i = digits(total);
> - while (i++ < 4)
> + while (i++ < 5)
> {
> putchar(' ');
> }
>
>
> ----------------------------------------------------------------
> Then, concerning the complaint about the empty line (bug #220996), I
> couldn't really reproduce this. But it seems that specifically this issue
> was already fixed in HEAD by this one here:
> https://reviews.freebsd.org/D11693
>
> ----------------------------------------------------------------
> Now, can anybody make the above snippets appear in HEAD and 11-STABLE?
>
I've CC'd allanjude, who has touched some of these in the past.
Glen
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
iQIyBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAll7gA4ACgkQAxRYpUeP
4pN8SA/4hzGvoe1LP/imv3boiJyIbcWcnV00+TTAgc2oXJGIL1q8egAlkzrBuiM1
xPMUM9Im7xV2/w0HXYB6obIQbDB2r8B88SV+aWCodblzShDj23DOxyvKCSi5V3nQ
yH4E5AMq8RHEDpCD09Po5/AiZkW0o70hNHGnhb6Gf5yIrTTgP9zJ2ejV+BCmSOE4
k2PQG1N4kY0CPwqFfB9ECbCIt4O51N3XxDnnWQxutXV8e6mvp10w0zKL5ugVHOkE
n77Rxnr4kDaTbB5lyXofRfq3h69/G/A80L9t1jqwAx01+ADioo4eSth68OJgpvlM
BIuplMGcSYfo+JnU1orHCpU/V8xrbBw4hlfU7aVSQkJOjAWg9iGyn3W2QvNpR2cs
7/nBml54iq+quGxhTsrxPfZkU4nSseuS8vN96DwPRFEPSLX8FnPSUs2boJ0XQ5d/
WcUw+sD7jDwqCbxByojTLnrjWdqkN3Ofp0mHno3pRmn7mJdFl1nTU/CDVLzBQLiz
NF37oONxg875PgfT9BB5AVpiWqyUFqD8oVDCGyOjxoEa/9IZBcHusJm6zxB8DSoD
DOjGALj+4LBLuip5Oer8SDYMmQs9/myqTa1bBIEYq8ZnCl98MvpumXVgscZuiPjG
J13qNpcOxdsApYfO/+udWjNnOvuXeeoYyeEyLsXnlfZdhEkTsw==
=IJHr
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170728181859.GI32551>
