﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13901	File.chunks fails to read the entire file for some file-like objects	Erin Kelly	nobody	"The File.chunks method gets the size of the file and then decrements a counter by the chunk size for each read until it reaches 0.  The problem is that the read method is not guaranteed to return the full amount requested, and so the amount read may be less than the chunk size, resulting in the counter being decremented erroneously.  I ran into this bug while using a file-like object that wraps a java.io.InputStream object, whose read method returns as soon as data is available.

This patch is one possible solution, although it still has the problem that it will result in a busy-loop if the read method is entirely non-blocking.  It also potentially yields non-terminal chunks smaller than the chunk size, which may not be desirable.

See also #9632, which may affect the implementation here if it is accepted."	Bug	closed	File uploads/storage	dev	Normal	wontfix			Accepted	1	0	1	0	0	0
