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

Infinite loop with File.Readdir() #75

Closed
lmas opened this issue Jan 8, 2016 · 1 comment
Closed

Infinite loop with File.Readdir() #75

lmas opened this issue Jan 8, 2016 · 1 comment

Comments

@lmas
Copy link

lmas commented Jan 8, 2016

Edit: cleaned up the whole issue...

The documentation for os.File.Readdir(n) states that when n > 0, Readdir() must return a io.EOF at the end of the directory.
rice.File.Readdir() doesn't comform to this behavior, for appended files and dirs, and so we will enter an infinite loop in https://golang.org/src/net/http/fs.go#L70 when we try to serve appended files with http.FileServer and rice.box.HTTPBox().

I'm afraid that rice.File.Readdir() needs to be rewritten so it instead will work over multiple calls (for example: first call returns all files/dirs in current dir, second call returns io.EOF to end the loop). But that means it needs to save some kind of state and shit, so it would be a pretty big change...
Edit: Nvm, I finally noticed you already got it figured out, for embedded files at least.

@lmas lmas changed the title Infinite loop for dir Infinite loop with File.Readdir() Jan 8, 2016
@GeertJohan
Copy link
Owner

Duplicated by #108. Work is being done in that issue to solve this bug. Thanks for reporting!

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

No branches or pull requests

2 participants