On Wed, 23 Feb 2022 18:49:22 GMT, Ichiroh Takiguchi <itakigu...@openjdk.org> 
wrote:

>> Run jtreg:jdk/java/lang/ProcessBuilder/Basic.java on AIX.
>> The test was failed by:
>>   Incorrect handling of envstrings containing NULs
>> 
>> According to my investigation, this issue was happened after following 
>> change was applied.
>> JDK-8272600: (test) Use native "sleep" in Basic.java
>> 
>> test.nativepath value was added into AIX's LIBPATH during running this 
>> testcase.
>> On AIX, test.nativepath value should be removed from LIBPATH value before 
>> comparing the values.
>
> Ichiroh Takiguchi has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Add null check

Hi Roger,

> The piece I was missing is that the HotSpot AIX specific code, computes and 
> sets LIBPATH based on the path to the java executable. This computed LIBPATH 
> value is set in the environment unless it is overridden by an existing 
> LIBPATH in the environment.

Ah, thank you for this missing piece! Now I remember. We modify LIBPATH in the 
java launcher itself. Since the test executable here is also java we call 
setenv(LIBPATH,..) in the child process. On AIX we do this unconditionally, 
that may be the difference to other platforms.

The point of this test was not to test `System.getenv()` but that Runtime.exec 
passes the env vector correctly, right? Then a maybe simpler alternative would 
have been to spawn `sh -c env`, or a simple little C program printing its env 
vector, instead of java. Less side effects. Test may be a bit quicker too, 
since child startup would be faster (probably does not save much in the big 
scheme of things).

Thanks, Thomas

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

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

Reply via email to