-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
low
-
The fallback to use $HOME is used only in environments where the operating system provides an unusable home directory.
-
System or security property, Use or define an environment variable
-
Implementation
Summary
The value of system property user.home set to $HOME if the home directory provided by the operating system is invalid.
Problem
In some Linux environments, the Linux home directory provided by getpwent() is not usable, either consisting of a single character or missing.
Currently, the environment variable $HOME is ignored and user.home is set to ?, also unusable.
On Linux systems, a java program running under systemd or when running in a container, such as Docker may see a home directory of "/".
"/" should not be usable as a home directory.
Solution
On Linux and macOS, 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.
A single character, including "/", is not a valid home directory.
If $HOME is undefined or empty, the value of the getpwent.user_home is retained as the value for user.home.
Specification
The implementation that initialized the system property user.home is modified to check if the home directory provided by the operating system is less than two characters long. If so, the value of $HOME is used as the value of user.home, if $HOME is not empty.
- csr of
-
JDK-8280357 user.home = "?" when running with systemd DynamicUser=true
-
- Resolved
-