typelead / eta

The Eta Programming Language, a dialect of Haskell on the JVM
https://eta-lang.org
BSD 3-Clause "New" or "Revised" License
2.6k stars 142 forks source link

Fix path used for temp file creation #947

Closed mgsloan closed 5 years ago

mgsloan commented 5 years ago

File.pathSeparatorChar is the separator for PATH and similar variables. File.separatorChar is the correct separator for directories.

Description

The temp file code was using : as the path separator instead of /, leading to paths like /tmp:criterion425512593.json.

How Has This Been Tested?

Running a criterion benchmark yielded

Exception in thread "main" java.nio.file.AccessDeniedException: /tmp:criterion425512593.json
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
        at java.base/sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:178)
        at java.base/java.nio.channels.FileChannel.open(FileChannel.java:292)
        at eta.base.Utils.fileChannelOpen(Utils.java:600)
        at base.system.posix.Internals$c_open1.call(Internals.hs:344)
        at base.system.IO$$wa.call(IO.hs:500)
        at criterion.criterion.Internal$$wa6.call(Internal.hs:125)
        at criterion.criterion.Main$defaultMain3.call(Main.hs:173)
        at criterion.criterion.Main$defaultMain2.call(Main.hs:152)
        at main.Main$main1.call(Main.hs:20)
        at main.Main$main1.applyV(Main.hs)
        at eta.runtime.exception.Exception.catch_(Exception.java:129)
        at main.Main$main20.call(Main.hs)
        at main.Main$DZCmain.call(Main.hs:20)
        at main.Main$DZCmain.applyV(Main.hs:20)
        at eta.runtime.stg.Closures$EvalLazyIO.enter(Closures.java:152)
        at eta.runtime.stg.Capability.schedule(Capability.java:246)
        at eta.runtime.stg.Capability.scheduleClosure(Capability.java:202)
        at eta.runtime.Runtime.evalLazyIO(Runtime.java:392)
        at eta.runtime.Runtime.main(Runtime.java:385)
        at eta.main.main(Unknown Source)

After this fix, the criterion benchmark doesn't work (hangs), but at least it doesn't immediately throw this error.

Types of changes

Checklist:

CLAassistant commented 5 years ago

CLA assistant check
All committers have signed the CLA.