typelead / eta-hackage

A set of patches to make Hackage compatible with the Eta language.
64 stars 31 forks source link

Temporary library -- creation of temp files does not work on windows platform #70

Closed indegro closed 6 years ago

indegro commented 6 years ago

I used temprorary library withFile and got the following exception

xception in thread "main" eta.runtime.exception.EtaException: JException java.lang.UnsupportedOperationException: 'p osix:permissions' not supported as initial attribute at base.ghc.TopHandler.runMainIO2(TopHandler.hs) at base.ghc.TopHandler$runMainIO2.apply1V(TopHandler.hs) at eta.runtime.exception.Exception.catch_(Exception.java:166) at main.Main.main11(Main.hs:16) at main.Main.DZCmain(Main.hs:16) at main.Main$DZCmain.applyV(Main.hs:16) at eta.runtime.stg.Closures$EvalLazyIO.enter(Closures.java:104) at eta.runtime.stg.Capability.schedule(Capability.java:174) at eta.runtime.stg.Capability.scheduleClosure(Capability.java:119) at eta.runtime.Runtime.evalLazyIO(Runtime.java:189) at eta.runtime.Runtime.main(Runtime.java:182) at eta.main.main(Unknown Source) Caused by: java.lang.UnsupportedOperationException: 'posix:permissions' not supported as initial attribute at sun.nio.fs.WindowsSecurityDescriptor.fromAttribute(WindowsSecurityDescriptor.java:358) at sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:107) at java.nio.channels.FileChannel.open(FileChannel.java:287) at eta.base.Utils.fileChannelOpen(Utils.java:415) at base.system.posix.Internals.c_open1(Internals.hs:344) at base.system.IO.$wa(IO.hs:491) at temporary.system.io.Temp$sat_sX96.applyV(Temp.hs:86) at eta.runtime.thunk.Thunk.applyV(Thunk.java:117) at base.ghc.Base.bindIO1(Base.hs:1021) at base.ghc.Base$bindIO1.apply2V(Base.hs) at eta.runtime.apply.PAPSlow.apply(PAPSlow.java:62) at eta.runtime.apply.PAPSlow.applyV(PAPSlow.java:110) at eta.runtime.exception.Exception.maskAsyncExceptions(Exception.java:42) at exceptions.control.monad.Catch.$fMonadMask_IO2(Catch.hs:194) at exceptions.control.monad.Catch$$fMonadMask_IO2.apply1V(Catch.hs) at eta.runtime.apply.PAP1_1.applyV(PAP11.java:17) at mockery.test.mockery.Directory.withFile1(Directory.hs:45) at main.Main.main1(Main.hs:24) at main.Main$main1.applyV(Main.hs) at eta.runtime.exception.Exception.catch(Exception.java:129) ... 9 more

rahulmutt commented 6 years ago

When implemented File I/O in base, and we used PosixFilePermissions through out. An OS check should be done and avoid that code path and replace it with windows equivalent version.

The method is fileChannelOpen in libraries/base/java-utils/Utils.java. Would you be interesting in taking a stab at this?

https://stackoverflow.com/questions/14415960/java-lang-unsupportedoperationexception-posixpermissions-not-supported-as-in

indegro commented 6 years ago

@rahulmutt yes, it would be interesting for me to take this bug and to try to fix it.

rahulmutt commented 6 years ago

This should be fixed now.