clone 477134 -1
reassign -1 perl
submitter -1 !
retitle -1 XS_VERSION_BOOTCHECK only partly respects locales
severity -1 important

# Fixed in Git commit 1414be781fd942db24a8e2e06b97d518d077e047.
# See http://git.snow-crash.org/?p=pkg-rrdtool.git.
tags 477134 + pending
thanks

Hi,

Thanks for reporting this.

On Mon, Apr 21, 2008 at 11:23:51AM +0200, Javier Uruen Val wrote:
> Justification: renders package unusable

As Bernd already pointed out, this is not quite true.

> RRDs perl module fails to use if locales set a decimal separator different to
> '.'. In this case, the Spanish locales (es_ES.UTF-8) use ',' as a decimal
> separator. DynLoader seems to compare on the left-hand side using a decimal
> point, and on the right-hand side using the coma. This is what I get:
> 
> RRDs object version 1.2027 does not match bootstrap parameter 1,2027 at
> /usr/lib/perl/5.8/DynaLoader.pm line 245.
> 
> 
> The above bug is easily reproducible by running the following perl script:
> 
> use POSIX;
> my $loc = POSIX::setlocale( &POSIX::LC_ALL, "es_ES.UTF-8" );
> eval('use RRDs');
> print "$@";

The problem here is that XS_VERSION_BOOTCHECK, as used inside the C part
of the RRDs module (and most other Perl modules using XS), uses
string-compare to compare the value passed to DynaLoader::bootstrap() as
second argument with the version string as provided at compile time [1].
Now, a floating point value is used inside RRDs to define the version
(as documented in perlmodlib(1) [2]), which is automatically converted
to a string. During that conversion, locales are respected, which is
obviously not the case for the constant string stored in XS_VERSION.
This can be worked around by assigning a string to $VERSION (in RRDs.pm)
- which should not be done though according to perlmodlib(1). Thus, this
should imho be fixed in Perl, e.g. by converting the floating point
value in a locale-unaware manner (thus reassigning a clone of this bug
to perl).

Cheers,
Sebastian

[1] "strNE(XS_VERSION, SvPV_nolen_const(_sv))"
    (see /usr/lib/perl/5.8/CORE/XSUB.h, line 257 [in version 5.8.8-12])

[2] "To be fully compatible with the Exporter and MakeMaker modules you
        should store your module's version number in a non-my package
        variable called $VERSION. This should be a floating point number
        [...]"

-- 
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/

Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin

Attachment: signature.asc
Description: Digital signature

Reply via email to