#2462 closed defect (fixed)
remove bare asserts for segment out-of-range errors in mutable retrieve
Reported by: | daira | Owned by: | warner |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.2 |
Component: | code-mutable | Version: | 1.10.1 |
Keywords: | cleanup error mutable retrieve download | Cc: | |
Launchpad Bug: |
Description (last modified by daira)
Traceback (most recent call last): File "/home/davidsarah/tahoe/git/trunk/src/allmydata/mutable/filenode.py", line 990, in <lambda> self._serializer.addCallback(lambda ignore: cb(*args, **kwargs)) File "/home/davidsarah/tahoe/git/trunk/src/allmydata/mutable/filenode.py", line 980, in _read d = r.download(consumer, offset, size) File "/home/davidsarah/tahoe/git/trunk/src/allmydata/mutable/retrieve.py", line 244, in download self._setup_encoding_parameters() File "/home/davidsarah/tahoe/git/trunk/src/allmydata/mutable/retrieve.py", line 411, in _setup_encoding_parameters assert start < self._num_segments exceptions.AssertionError:
There are at least two bare asserts, one for the start segment and one for the end segment.
Change History (9)
comment:1 Changed at 2015-07-07T19:08:55Z by daira
- Description modified (diff)
- Status changed from new to assigned
- Summary changed from remove bare assert for segment out-of-range error in mutable retrieve to remove bare asserts for segment out-of-range errors in mutable retrieve
comment:2 Changed at 2015-07-07T19:10:11Z by daira
comment:3 follow-up: ↓ 4 Changed at 2015-07-07T20:15:47Z by daira
The current error behaviour is confusing; it appears that you can read one byte past the end of the file, only if the file is not a multiple of k bytes (i.e. you can read the dummy bytes that are added to make the size of the input to encoding a multiple of k bytes). This should probably be made stricter.
comment:4 in reply to: ↑ 3 Changed at 2015-07-07T23:13:20Z by daira
Replying to daira:
The current error behaviour is confusing; it appears that you can read one byte past the end of the file, only if the file is not a multiple of k bytes (i.e. at this API layer, you can read the dummy bytes that are added to make the size of the input to encoding a multiple of k bytes).
See https://github.com/tahoe-lafs/tahoe-lafs/commit/e437bfd64bf4fb6838036fde9aa05f987f911320#diff-8d5163da85905f8ddd5ce6a535206479R3403, which reads one byte past the end of the file, and passes. (The same thing happens when reading 101 bytes of a 100-byte SDMF file.) The explanation above may not be correct, though; it's just a guess.
comment:5 Changed at 2015-07-17T21:53:09Z by daira
- Milestone changed from 1.11.0 to 1.10.2
comment:6 Changed at 2015-07-27T20:13:26Z by warner
- Owner changed from daira to warner
- Status changed from assigned to new
comment:7 Changed at 2015-07-28T18:04:14Z by Brian Warner <warner@…>
comment:8 Changed at 2015-07-28T20:40:26Z by Brian Warner <warner@…>
- Resolution set to fixed
- Status changed from new to closed
comment:9 Changed at 2015-07-28T22:00:38Z by daira
Reviewed, +1.
The exception raised should be as documented in interfaces.py, per #2461.