RFR: 8280357: user.home = "?" when running with systemd DynamicUser=true [v2]

Naoto Sato naoto at openjdk.java.net
Wed Feb 23 22:16:06 UTC 2022


On Wed, 23 Feb 2022 21:51:50 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> src/java.base/unix/native/libjava/java_props_md.c line 498:
>> 
>>> 496:             if ((user_home != NULL) && (user_home[0] != '\0')) {
>>> 497:                 sprops.user_home = user_home;
>>> 498:             }
>> 
>> Is there any possibility where `user.home` is not initialized, and later causes SEGV or NPE? I just wonder the previous version always init to `?` which is odd, but guaranteed not to cause those errors.
>
> I can't imagine it not being set. But it is easier to track down the source of a "?" than the source of null.
> I thought of changing from "?" to "UNKNOWN" or "NOHOMEDIR" or something but it seems quite remote
> after adding the fallback to $HOME.

Another option is an empty string `""`, but I don't have a strong preference if it won't throw any errors.

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

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


More information about the core-libs-dev mailing list