title: Bazel- how to get a short but hermetic temp dir for tests?
body: <p>I have a test which tries to start an embedded mysql.<br>
  It tries to write a socket file to <code>Files.createTempFile(null, ".sock")</code> which returns with the following error:
  <code>mysql start failed with error: [ERROR] The socket file path is too long (&gt; 103): /private/var/tmp/_bazel_user/1c8ed8d84f6cb79483aa3cc4da758c86/bazel-sandbox/2478112867584790357/execroot/some_workspace/_tmp/dfebe48cda4dfdc8739653efedfa4933/394798020705754292.sock</code>.<br>
  I worked around it by re-pointing java temp dir to <code>/tmp</code> using <code>jvm_flags</code> but this doesn't work when I try to use sandboxing since I <em>guess</em> the test isn't allowed to write there.  </p>
  
  <p>I've tried setting a symbolic link from the java code (like so <code>Files.createSymbolicLink(Paths.get("/tmp/foo"),Paths.get(System.getProperty("java.io.tmpdir")))</code> but this doesn't seem to help.  </p>
  
  <p>I've also tried setting the <code>output_base</code> but that didn't help either.  </p>
  
  <p>Would really appreciate pointers and tips since I currently can't run my tests under sandbox and so can't parallelize them.</p>