RFR: 8271003: hs_err improvement: handle CLASSPATH env setting longer than O_BUFLEN

Thomas Stüfe thomas.stuefe at gmail.com
Tue Aug 3 04:11:26 UTC 2021


On Tue, Aug 3, 2021 at 12:53 AM David Holmes <david.holmes at oracle.com>
wrote:

> On 3/08/2021 3:40 am, Calvin Cheung wrote:
> > On Mon, 2 Aug 2021 07:02:35 GMT, David Holmes <dholmes at openjdk.org>
> wrote:
> >
> >> `outputStream::do_vsnprintf` already states that it uses the buffer "if
> necessary". In the two highlighted cases there is no need to use the
> buffer, so I would argue that we should just modify the existing
> `outputStream::do_vsnprintf` logic to not truncate in these two cases as it
> is not necessary.
> >>
> >> David
> >
> > I was thinking of changing `outputStream::do_vsnprintf` to make use of
> the `handle_simple_format()` as a separate RFE.
>
> Sorry Calvin but I'd rather see a single complete solution in one step.
>
> IIUC the only time we have a problem with truncation is when we have
> add_cr==true. So it seems to me that a simple solution for this is to
> not handle the cr in those low-level routine at all but simply change:
>
> void outputStream::vprint_cr(const char* format, va_list argptr) {
>    do_vsnprintf_and_write(format, argptr, true);
> }
>
> to
>
> void outputStream::vprint_cr(const char* format, va_list argptr) {
>    do_vsnprintf_and_write(format, argptr);
>    cr();
> }
>
> or add the "add_cr" to the write() method and let it handle it without a
> need for intermediate buffering.
>
> Thanks,
> David
>

Missed your mail since the duplication of ML mails into github
conversations still does not work :(

See my answer to Calvin, I think we want to write the output with a single
call to write(2) to reduce tear. That includes the newline. I think
including it in write(2) was intentional.

..Thomas


More information about the hotspot-runtime-dev mailing list