Nexus intends to only use one tmp directory and by default this should be in sonatype-work/nexus/tmp
However this is not happening in all cases.
Nexus does not seem to preset the value of java.io.tmpdir to explicitly under sonatype-work anymore, unless value of java.io.tmpdir is null, which is normally not the case - see here.
Further, we attempt to read, validate and reset the temporary directory
However resetting the temporary directory in this manner, especially using getPath(), would seem a noop. For example Files.createTempFile(String,String) explicitly states such - and code review shows the value of temp dir to be cached statically anyways.
...because further it's value is injected in ApplicationDirectoriesImpl which is depended on by many other code locations.
Things that have a chance of breaking in current code:
- only specifying java.io.tmpdir in wrapper.conf
- only specifying java.io.tmpdir in nexus.properties
The only sane way to override java.io.tmpdir currently is to specify the same absolute value in both places.
We should change this such that only one place is needed. We should also fix the various race conditions possible in our code and revisit use of createTempfile where it relies on default temp dir. Lastly enforce the correct default tmp dir location