RFR: 8374341: Use of "\s" instead of "\\s" in CoreUtils.java results in splitting on backspace instead of whitespace [v2]
Kevin Walls
kevinw at openjdk.org
Tue Jan 6 19:30:01 UTC 2026
On Wed, 24 Dec 2025 23:53:39 GMT, Eunbin Son <duke at openjdk.org> wrote:
>> ### Summary
>> Fix incorrect regex usage in CoreUtils.getCoreFileLocation.
>>
>> ### Description
>> CoreUtils.getCoreFileLocation uses String.split("\s", 2).
>> The string literal "\s" represents a backspace character, not a whitespace regex.
>> As a result, the split operation does not separate fields on whitespace.
>> This change replaces the pattern with `"\\s+"` to correctly split on whitespace.
>> No other logic is modified.
>>
>> ### Bug ID : JDK-8374341
>> https://bugs.java.com/bugdatabase/view_bug?bug_id=8374341
>
> Eunbin Son has updated the pull request incrementally with one additional commit since the last revision:
>
> 8374341: Update copyright year to 2025 for CoreUtils.java
So that matching has never worked. 8-)
But if we make this change, and it runs coredumpctl, does this now work as intended?
I see "No journal files were opened due to insufficient permissions." from coredumpctl (but I didn't test during a test that creates a core).
Another problem may be the unpredictability of the timing when files are large: the 5 second sleep and the 10 iterations. Is that always enough? Maybe this is fine, but if it has never actually been used, the code should be verified well before it's enabled.
On my systems when a core dump pattern has the "|", I am familiar with seeing the message "This system uses a crash report tool.." from later in the file. It tells you the system is configured inappropriately, so you fix the pattern manually, and all is good.
Maybe we should delete lines 168 to 191 and simply have that message at line 192 printed, and a test skipped, if a core file pattern using "|" is in place.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28984#pullrequestreview-3632198702
More information about the serviceability-dev
mailing list