Review request for 7034570 - java.lang.Runtime.exec(String[] cmd, String[] env) can not work properly if SystemRoot not inherited

David Holmes David.Holmes at oracle.com
Thu Apr 14 23:44:12 UTC 2011


Ulf,

Ulf Zibis said the following on 04/15/11 04:02:
> Oops, SystemRoot could be null theoretically. So forget my comment about 
> NUL termination.
> 
> But anyway, should we allow to have get("SystemRoot") != 
> getEnv("SystemRoot")?
> 
> Is it correct to defaultly set the "SystemRoot" variable on non-Windows OS?

This ProcessEnvironment.java is a Windows specific file.

David


> Why don't we inherit ProcessEnvironment from TreeMap, sorted by 
> EntryComparator?
> Then we would not need to sort it later.
> 
>  > The environment block is required to be sorted when you call 
> CreateProcess() on Windows.
> Shouldn't we handle this OS-dependent? There is no need to sort on 
> non-Windows OS, and if, it should be case-sensitive.
> 
> Imagine:
> ProcessEnvironment pe;
> pe.put("systemroot", "C:\\WINDOWS");
> String systemroot = pe.get("SYSTEMROOT");
> 
> systemroot would remain null!
> So I ask, if we wouldn't better implement class ProcessEnvironment 
> OS-dependent?
> 
> -Ulf
> 
> 
> Am 14.04.2011 18:34, schrieb Ulf Zibis:
>> You need not to ensure double NUL termination, because now sb.length() 
>> is always > 0.
>>
>> -Ulf
>>
>>
>> Am 14.04.2011 16:06, schrieb Michael McMahon:
>>> An updated webrev is available for this fix. I'll probably go ahead
>>> with the CCC request for the spec. change anyway.
>>>
>>> http://cr.openjdk.java.net/~michaelm/7034570/webrev.2/
>>>
>>>
>>> Thanks,
>>> Michael.
>>>
>>



More information about the core-libs-dev mailing list