Bug#482139: [PATCH] Document that XS_VERSION_BOOTCHECK may break if $VERSION is a long enough NV

Niko Tyni ntyni at debian.org
Wed Apr 29 20:02:01 UTC 2009


As seen in <http://bugs.debian.org/482139>, using a long floating point
number as $VERSION can make XS_VERSION_BOOTCHECK fail because of a loss
of precision in the stringification:

RRDs object version 1.2999070803 does not match bootstrap parameter 1.29990708 at /usr/lib/perl/5.10/DynaLoader.pm line 219.

The mismatch happens in Perl_upg_version(), which converts a double value
(NV) to a string with nine decimals but leaves a string value intact.

Using a string as $VERSION works fine:

-$VERSION=1.299907080300;
+$VERSION="1.299907080300";

so recommend this in the VERSIONCHECK entry of perlxs.pod.
---
 pod/perlxs.pod |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/pod/perlxs.pod b/pod/perlxs.pod
index c367f4c..a6e21a3 100644
--- a/pod/perlxs.pod
+++ b/pod/perlxs.pod
@@ -1211,6 +1211,12 @@ To disable version checking:
 
     VERSIONCHECK: DISABLE
 
+Note that if the version of the PM module is an NV (a floating point
+number), it will be stringified with a possible loss of precision
+(currently chopping to nine decimal places) so that it may not match
+the version of the XS module anymore. Quoting the $VERSION declaration
+to make it a string is recommended if long version numbers are used.
+
 =head2 The PROTOTYPES: Keyword
 
 The PROTOTYPES: keyword corresponds to B<xsubpp>'s C<-prototypes> and
-- 
1.5.6.5







More information about the Perl-maintainers mailing list