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

David Holmes david.holmes at oracle.com
Mon Aug 2 22:52:51 UTC 2021


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

> -------------
> 
> PR: https://git.openjdk.java.net/jdk/pull/4947
> 


More information about the hotspot-runtime-dev mailing list