Page 1 of 1

pre-2.7.2 sprintf bug characteristics?

Posted: Mon Dec 21, 2015 4:53 pm
by mruck
I'm using NNDK 2.6.5 - not really prepared to upgrade at the moment, but I'm looking into some funny syslog output. We're seeing bad %f output and we're seeing lines truncated at the %f. I saw that the release notes for 2.7.2 included:

Fixed error in sprintf and siprintf which caused early termination of printing

I'm guessing that's causing my truncated syslog lines.

We're also seeing alternating characters in the formatted data - e.g. %f formats to 131.313131 in one run, or maybe -0.003535 in another run - not at the same time as the truncated printing. Seems all the %f goes bad at the same time, and the alternating characters change from run to run. I'm wondering if this is actually the same bug that caused the truncated output - maybe the truncated output inserted nulls instead of digits?

How involved is the sprintf fix? Can I just lift a library from 2.7.3 and use it in 2.6.5?

Re: pre-2.7.2 sprintf bug characteristics?

Posted: Tue Dec 22, 2015 12:35 pm
by rnixon
I would try building your app in 2.7.3 as a test and verify the problem goes away.

Re: pre-2.7.2 sprintf bug characteristics?

Posted: Tue Dec 22, 2015 12:37 pm
by sblair
Be aware there's a number of issues with the printf functions that I discovered in the 2.7.3 beta. These were new issues introduced since our production code runs on 2.6.7 and didn't experience them. I spent a bunch of time working with Dan and he plowed through and fixed them all.

These may be different issues than what you're seeing, but I'd suggest waiting for the next drop to happen or at least get the patches for them all if you're looking at this under 2.7.3 beta.

Scott

Re: pre-2.7.2 sprintf bug characteristics?

Posted: Tue Dec 22, 2015 12:53 pm
by mruck
It looks like the updated printf is fairly well encapsulated in nburn/system files, so it looks like I can drop it in to 2.6.5. That looks faster/easier than porting my app to 2.7.3.

However, it doesn't look like it fixes syslog - syslog uses vsnprintf(), which doesn't look implemented in 2.7.3beta (as in not replaced, therefore still the old problem code).

I was going to try my own vsnprintf() wrapper, but I'll ask for the patches first.

Thanks!