Closed dbungert closed 1 year ago
hey there =] i saw your bug filed this morning on Launchpad. thanks a lot for looking into this.
i'm super tired right now after being awake for many hours, but this doesn't look quite right. i suspect there is a bug deeper in the code. that output ought definitely be "0.00" as i understand it....
oh, wait, reading your comment again, your patch does make it output "0.00". ok, great, good work! imma go smoke a cigarette and then come back in and merge this assuming i don't think of any other problems, real or imagined.
i should probably update the notcurses_metric.3
man page to not use INT_MAX
in all the examples, too.
merged! thanks a bunch!
In the metric test is a call to ncnmetric, which eventually calls snprintf. Along the way is a size that is much larger than the actual bufsize, but it shouldn't matter as the buffer size exceeds what we print (or at least what is expected).
In testing with glibc 2.37 on armhf on Ubuntu Lunar, I found that these metric tests can fail with some unexpected truncation of the values.
For example, in the following check,
buf would actually be "0.0".
Using a more realistic buffer size produces a working result.