You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
lmas
changed the title
Infinite loop for dir
Infinite loop with File.Readdir()
Jan 8, 2016
Edit: cleaned up the whole issue...
The documentation for
os.File.Readdir(n)
states that when n > 0,Readdir()
must return aio.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 withhttp.FileServer
andrice.box.HTTPBox()
.I'm afraid thatrice.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 returnsio.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.
The text was updated successfully, but these errors were encountered: