Skip to content

DiskReporter._tail bug

Reed Essick requested to merge really-annoying-bug-in-_tail into master

fixed a bug in DiskReporter._tail that caused lines to be erroneously concatenated if they were exactly byte_stride in length. Specifically, the call to line.strip() was removing trailing \n characters from the line, which then meant the call to split('\n')[-1] returned a non-empty string which was then concatenated onto the previously-read characters.

This fix now only calls split('\n')[-1], and if the new line ends in \n will then concatenate an empty string to the front of the result, which does no harm.

I tested this with a variety of line lengths (shorter than, longer than, and equal to byte_stride), and it appears to do the right thing in all cases.

Merge request reports

Loading