Hi Robert,
On Apr 23, 2018, at 7:23 AM, Robert Stupp <[email protected]> wrote:
> For MacOS and Windows, Java prefers the user's temporary directory for
> java.io.tmpdir, but not for Linux, where it is always set to /tmp. The burden
> with this is that if you want to use a different temp directory, you have to
> explicitly pass -Djava.io.tmpdir=... on the command line, which can be
> difficult especially for unit tests or microbenchmarks in 3rd party code ran
> via Maven for example.
>
> java_props_t.tmp_dir is always initialized as P_tmpdir in GetJavaProperties
> (src/java.base/unix/native/libjava/java_props_md.c).
>
> The attached patch changed the behavior to use the content of the environment
> variable TMPDIR, if present. Note that this does not change where the hsperf*
> folders are created.
The source change looks OK to me aside from the copyright year and that in the
second line here
+ v = getenv("TMPDIR");
+ if (v) {
+ sprops.tmp_dir = strdup(v);
+ }
it should probably have
+ if (v != NULL) {
for consistency with elsewhere in the file.
> I'm not sure why java.io.tmpdir is always /tmp in Linux as according to the
> SCM history, this was always as it is (references the initial OpenJDK commit).
>
> I haven't found any tests that validates the content of java.io.tmpdir.
Some sort of test would need to be added to this patch to validate the change.
Thanks,
Brian