Page MenuHomePhabricator

[LevelDB] Plug leveldb logs to bitcoin logs
ClosedPublic

Authored by deadalnix on Jan 4 2018, 19:40.

Details

Summary

Backport of core's PR9999

Test Plan
make check

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Herald added a reviewer: Restricted Project. · View Herald Transcript
src/dbwrapper.cpp
60 ↗(On Diff #2344)

When p = limit - 1 from above:

We check if *(limit - 2) != '\n', then we set *(limit - 1) = '\n' then add one to p leaving p == limit.

Below we have std::min(bufsize - 1, (int)(p - base)) => std::min(bufsize - 1, bufsize) == bufsize - 1 => base[bufsize-1] == limit - 1

Then we're effectively doing *(limit -1) = '\0' and eating the newline we just added? Is that all that can happen, or did I make a mistake?

src/dbwrapper.cpp
60 ↗(On Diff #2344)

Yes, but it's not a guarantee that p = limit - 1 so I don't see the problem here.

There are numerous other stupid stuff in the code, such as it allocate a buffer and free it at every loop iteration.

schancel added inline comments.
src/dbwrapper.cpp
60 ↗(On Diff #2344)

Just ensuring there aren't any edge cases that could screw things up. This seems like logging will just look weird.

This revision is now accepted and ready to land.Jan 5 2018, 21:34
This revision was automatically updated to reflect the committed changes.