RFR: 8348554: Enhance Linux kernel version checks [v2]
Aleksey Shipilev
shade at openjdk.org
Fri Jan 24 11:16:47 UTC 2025
On Fri, 24 Jan 2025 10:48:54 GMT, Robbin Ehn <rehn at openjdk.org> wrote:
>> src/hotspot/os/linux/os_linux.cpp line 392:
>>
>>> 390: return;
>>> 391: }
>>> 392: int nr_matched = sscanf(buffer.release, "%ld.%ld.%ld", major, patch, sub);
>>
>> Are we sure the kernel version always have 3 components? It would be safer to handle 2-component version as well, and set the third component to `0` in that case.
>
> I took another look; technically, only one is guaranteed by the source.
> However, in practice, there are always three (checked in Linux v3).
OK. I misread the code and thought the error is fatal when some components are not defined. But it is only a warning, so we are probably fine. Do you think it would be reasonable to initialize the components to `0`, though, so on 1- or 2-component version we would not have e.g. `2.18.-1`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23291#discussion_r1928523057
More information about the hotspot-runtime-dev
mailing list