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

David Holmes dholmes at openjdk.java.net
Mon Aug 2 06:53:31 UTC 2021


On Mon, 2 Aug 2021 02:26:06 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Please review this small enhancement for addressing the problem of the CLASSPATH env variable setting being truncated in a hs err log.
>> 
>> For printing a char string, it doesn't need to go through `do_vsnprintf()` which does the truncation based on the input buffer length. The change is local to the code path pertaining to hs err log.
>> 
>> Testing:
>> 
>> - [x] tiers 1, 2 (including the new test)
>
> src/hotspot/share/utilities/ostream.cpp line 140:
> 
>> 138:       str = format;
>> 139:       len = strlen(str);
>> 140:   } else if (format[0] == '%' && format[1] == 's' && format[2] == '\0') {
> 
> Why are you assuming the %s must be at the beginning rather than "blah blah %s blah" ?

Ah I see what you are doing now - the code just special cases the two cases of a string with no format specifiers, and a string that is only "%s". Anything else needs full handling.

-------------

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


More information about the hotspot-runtime-dev mailing list