Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pks-t
Copy link
Member

@pks-t pks-t commented Mar 23, 2018

In commit 7ec7aa4 (odb: assert on logic errors when writing objects,
2018-02-01), the check for whether we are trying to overflowing the fake
stream buffer was changed from returning an error to raising an assert.
The conversion forgot though that the logic around asserts are
basically inverted. Previously, if the statement

stream->written + len > steram->size

evaluated to true, we would return a -1. Now we are asserting that
this statement is true, and in case it is not we will raise an error. So
the conversion to the assert in fact changed the behaviour to the
complete opposite intention.

Fix the assert by inverting its condition again and add a regression
test.


/cc @ethomson

pks-t added 2 commits March 23, 2018 09:58
Our mempack ODB backend has no test coverage at all right now. Add a
simple test suite to at least have some coverage of the most basic
operations on the ODB.
In commit 7ec7aa4 (odb: assert on logic errors when writing objects,
2018-02-01), the check for whether we are trying to overflowing the fake
stream buffer was changed from returning an error to raising an assert.
The conversion forgot though that the logic around `assert`s are
basically inverted. Previously, if the statement

    stream->written + len > steram->size

evaluated to true, we would return a `-1`. Now we are asserting that
this statement is true, and in case it is not we will raise an error. So
the conversion to the `assert` in fact changed the behaviour to the
complete opposite intention.

Fix the assert by inverting its condition again and add a regression
test.
@pks-t
Copy link
Member Author

pks-t commented Mar 23, 2018

This is a regression, so it needs to be part of v0.27.0

@ethomson ethomson merged commit 6311e88 into libgit2:master Mar 23, 2018
@pks-t pks-t deleted the pks/mempack-assert branch July 11, 2019 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants