Hello,

2013/2/7 Eric Bollengier <eric.bolleng...@baculasystems.com>

> Hello Radosław,
>
> On 02/07/2013 05:42 PM, Radosław Korzeniewski wrote:
> >
> > I have a question regarding a Bacula bsnprintf library function. Is
> > bsnprintf supposed to work with a format: "%.2f"? If so, I found a
> > strange behavior or a bug.
>
> bsnprintf is a "partial" implementation of the snprintf function, the
> main goal is to be portable between all systems, and the second goal,
> not least, is to not expose Bacula to security issues due to special %
> formats (some of them can execute code in the stack for example, very
> powerful, but not used 99% of the time and very dangerous).
>

I know that, I read the code :)


>
> Bacula is not currently using floating numbers, so the %f implementation
> is not implemented.
>
>
Not exactly true, bsnprintf has a %f implementation and it is used at least
in software compression ratio messages at the end of every job (see around:
src/dird/backup.c:726).

Additionally, If you test other floating point numbers bsnprintf library
function works. The only problem (bug) I found is proper generation of
numbers in range of 1.01 till 1.09.

The main difference between compression ratio messages usage and my
requirement is a fractional number precision - 1 digit vs. 2 digits. But
according to src/lib/bsnprintf.c:693, it should support up to 9 digits:

/*
 * Sorry, we only support 9 digits past the decimal because of our
 * conversion method
 */

So, in my very humble opinion it should work but it doesn't. Or do I miss
something?

best regards
-- 
Radosław Korzeniewski
rados...@korzeniewski.net
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to