mafintosh/fuse-bindings

Undefined file size on stat

Opened this issue · 0 comments

Is it possible to leave the file size in a stat call undetermined?

In https://github.com/Munter/fusile I had to add this very ugly size hack in order to account for the transpiled size being bigger than the source file. But the size of the transpiled file will not be available to me before the operation is done, and I want to avoid doing the work before the read operation.

The only reason this hack works because direct_io allows me to return 0 in a read callback, which should indicate to the consumer that the file is no longer, even though a read buffer has been allocated to account for the fake bloated file size I reported in the stat call.

The problem I have is that web servers seem to report the Content-Length header based on the stat size, and not close the connection when I return 0 in the read callback. Or the browser doesn't close the connection. No matter which of the two is at fault, the connection hangs and development is impossible.

So, can I leave the file size undertermined somehow and maybe trigger a different behavior by the web server (and other similar behaving clients)?

This is the issue in question: Munter/fusile#178