On Fri, 18 Feb 2022 15:29:34 GMT, Roger Riggs <rri...@openjdk.org> wrote:

> In some Linux configurations, the Linux home directory provided by getpwent 
> is not usable.
> The value of the system property `user.home` should fallback to the value of 
> $HOME 
> if getpwent.user_home is null or less that 2 characters long. "/" is not a 
> valid home directory name.
> 
> If $HOME is undefined or empty, the value of the getpwent.user_home is 
> retained.
> 
> There are more details in the Jira issue: 
> https://bugs.openjdk.java.net/browse/JDK-8280357
> 
> The fix has been tested manually on Ubuntu 20.0.4 using the suggested systemd 
> command line and variations.

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.

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

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

Reply via email to