Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bytestring (lazy) readFile not working properly #54

Closed
rpeszek opened this issue Sep 3, 2017 · 2 comments
Closed

bytestring (lazy) readFile not working properly #54

rpeszek opened this issue Sep 3, 2017 · 2 comments
Labels

Comments

@rpeszek
Copy link
Contributor

rpeszek commented Sep 3, 2017

The file is read

import qualified Data.ByteString.Lazy as LBS
    ...
      myLBS <- LBS.readFile "some file"

but doing anything with the bytestring results in error at some point.
I can print the bytestream but stack traces will print afterwords.
Trying something like this:

LBS.length myLBS

will exception immediatelly
The error looks like this:

Caused by: eta.runtime.exception.EtaException: Exception was thrown in rendering exception of type class java.lang.NullPointerException
	at base.foreign.c.Error$throwErrnoIfMinus1RetryMayBlock2.enter(Unknown Source)
	at base.ghc.io.FD$$wa5.enter(Unknown Source)
	at base.ghc.io.handle.Text$sat_sGLFS.enter(Unknown Source)
	at eta.runtime.apply.Function.applyPV(Function.java:120)
	at base.ghc.io.handle.Internals$wantReadableHandle2.enter(Unknown Source)
	at base.ghc.io.handle.Internals$sat_sG0K9.enter(Unknown Source)
	at eta.runtime.apply.PAP.apply(PAP.java:31)
	at eta.runtime.apply.PAP.applyV(PAP.java:41)
	at eta.runtime.thunk.Thunk.applyV(Thunk.java:121)
	at eta.runtime.exception.Exception.catch_(Exception.java:136)

Corresponding code works fine if compiled and executed with stack.

Example code reproducing the issue:
https://github.com/rpeszek/eta-misc-test/tree/eta-hackage-issue-54

I am at current head commit on eta master
1dbe87b19f815ba12ec33f558cb7b572a74e03c1

@rahulmutt rahulmutt added the bug label Sep 4, 2017
@rahulmutt
Copy link
Member

Thanks for reporting this! It turns out that is not really a bytestring problem, but a problem with readFile in general (the one from base).

@rahulmutt
Copy link
Member

Fixed on master. Try it out and re-open this issue if it doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants