Date: Sat, 28 May 2016 06:42:57 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 206128] vmstat -z is truncated when stdout is not terminal Message-ID: <bug-206128-8-dlPoGwASm7@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-206128-8@https.bugs.freebsd.org/bugzilla/> References: <bug-206128-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D206128 --- Comment #11 from Phil Shafer <phil@freebsd.org> --- Was finally able to reproduce this and have a fix. I was using the wrong v= alue when checking for available buffer space: diff --git a/libxo/libxo.c b/libxo/libxo.c index 9df67de..7a714b1 100644 --- a/libxo/libxo.c +++ b/libxo/libxo.c @@ -2816,7 +2816,7 @@ xo_format_string (xo_handle_t *xop, xo_buffer_t *xbp, xo_xff_flags_t flags, * but if we did the work ourselves, then we need to do it. */ int delta =3D xfp->xf_width[XF_WIDTH_MIN] - cols; - if (!xo_buf_has_room(xbp, delta)) + if (!xo_buf_has_room(xbp, xfp->xf_width[XF_WIDTH_MIN])) goto bail; /* In addition, I'm adding a high-water mark that will trigger a flush: @@ -6128,6 +6128,12 @@ xo_do_emit_fields (xo_handle_t *xop, xo_field_info_t *fields, XOIF_CLEAR(xop, XOIF_REORDER); + /* + * If we've got enough data, flush it. + */ + if (xo_buf_offset(&xop->xo_data) > XO_BUF_HIGH_WATER) + flush =3D 1; + /* If we don't have an anchor, write the text out */ if (flush && !XOIF_ISSET(xop, XOIF_ANCHOR)) { if (xo_write(xop) < 0) I'll roll a new version of libxo tomorrow. Apologies for taking so long with this, but it was mostly just an issue of reproducing it. I wasn't seeing enough churn in my "vmstat -z" value to trigger the issue, so I munged one of the regression tests to help. Thanks, Phil --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-206128-8-dlPoGwASm7>