]> arthur.barton.de Git - bup.git/commit
Don't return invalid data for offset reads (observed via fuse)
authorRob Browning <rlb@defaultvalue.org>
Mon, 3 Dec 2018 18:58:03 +0000 (12:58 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sat, 8 Dec 2018 22:12:24 +0000 (16:12 -0600)
commitaeb8ce7d7974a4e6f472ae546d3baab90e1e8aa1
treeed0783bbc4485a1eb3c02d745f563951f618c83c
parentd73c6d3f6bb90d1df1b2cfee101c8bbb3a93be29
Don't return invalid data for offset reads (observed via fuse)

Fix a serious bug in the vfs that could cause it to return invalid
data for chunked file read()s that didn't start at the beginning of
the file.  The issue was first observed via fuse, which makes sense
given that it streams a file in chunks that (currently) each come from
independent, increasing seek-offset FileReaders.

The previous dropwhile() invocation in the _tree_chunks generator,
used to skip past chunks that were completely before the offset, was
simple but wrong, and would skip too far.  Replace it with
_skip_chunks_before_offset().

Add randomized tests of both simple streaming reads, and seek offset
reads, which catch the problem, cover additional cases, and should
prevent regressions.

Thanks to voldial for reporting the problem and providing an easy way
to reproduce it.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/t/tvfs.py
lib/bup/vfs.py