]> arthur.barton.de Git - bup.git/commit - t/test.sh
vfs: File.open() needs to do a seek(0) on the cached FileReader.
authorAvery Pennarun <apenwarr@gmail.com>
Fri, 9 Jul 2010 04:38:32 +0000 (00:38 -0400)
committerAvery Pennarun <apenwarr@gmail.com>
Fri, 9 Jul 2010 04:40:43 +0000 (00:40 -0400)
commit53c48383f482ab6503486c76c729580e9b560f69
treea3131f9823a6a1681c993b8ac9462a404e7a035d
parenta91871e5a195c1e66d2e8736ba6087f11819a35a
vfs: File.open() needs to do a seek(0) on the cached FileReader.

Otherwise if you open a file, read through it, and close it, then do it
again, you'll get zero bytes the second time.

To make this efficient, change seek() to not discard its _chunkiter every
single time; instead, keep the _chunkiter around until trying to read() from
a location that *isn't* the current offset.  Now seeking around in the file
is cheap.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
lib/bup/vfs.py
t/test.sh