oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.36k stars 1.63k forks source link

[GR-51257] java.io.tmpdir property not respected in java.io.File.createTempFile? #7731

Open borkdude opened 1 year ago

borkdude commented 1 year ago

GraalVM version Oracle GraalVM 21.0.1 On macOS (but happens on linux too)

Repro:

public class Temp {
    public static void main(String[] args) throws java.io.IOException {
        System.out.println("env " + System.getenv("TMPDIR"));
        System.out.println("prop " + System.getProperty("java.io.tmpdir"));
        System.out.println("tmpfile " + java.io.File.createTempFile("clojure-lsp.", ".out"));
    }
}

Compile to native image.

I would expect java.io.File.createTempFile to be affected by either TMPDIRenv var or java.io.tmpdir system property, but it isn't:


$ TMPDIR=foo ./temp
env foo
prop /var/folders/j9/xmjlcym958b1fr0npsp9msvh0000gn/T/
tmpfile /var/folders/j9/xmjlcym958b1fr0npsp9msvh0000gn/T/clojure-lsp.295997061503198015.out

$ TMPDIR=foo ./temp -Djava.io.tmpdir=foo
env foo
prop foo
tmpfile /var/folders/j9/xmjlcym958b1fr0npsp9msvh0000gn/T/clojure-lsp.10085851538447407567.out
oubidar-Abderrahim commented 10 months ago

Hi, Thank you for reaching out, we'll take a look into this shortly

oubidar-Abderrahim commented 10 months ago

Tracked internally on GR 51257