Bug 2380086 - perl-BSON-1.12.2-16.fc43 FTBFS: t/mapping/double.t fail with perl 5.42.0
Summary: perl-BSON-1.12.2-16.fc43 FTBFS: t/mapping/double.t fail with perl 5.42.0
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: perl-BSON
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Petr Pisar
QA Contact: Fedora Extras Quality Assurance
URL: https://koschei.fedoraproject.org//pa...
Whiteboard:
Depends On:
Blocks: F43FTBFS
TreeView+ depends on / blocked
 
Reported: 2025-07-15 07:00 UTC by Petr Pisar
Modified: 2025-07-15 12:12 UTC (History)
2 users (show)

Fixed In Version: perl-BSON-1.12.2-17.fc43
Clone Of:
Environment:
Last Closed: 2025-07-15 12:12:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Petr Pisar 2025-07-15 07:00:07 UTC
perl-BSON-1.12.2-16.fc43 fails to build in Fedora 43 because tests fail like this:

t/mapping/dbref.t ................ ok
Possible precedence problem between ! and string eq at /home/test/fedora/perl-BSON/perl-BSON-1.12.2-build/BSON-v1.12.2/blib/lib/BSON.pm line 99.
t/mapping/decimal128.t ........... ok
Possible precedence problem between ! and string eq at /home/test/fedora/perl-BSON/perl-BSON-1.12.2-build/BSON-v1.12.2/blib/lib/BSON.pm line 99.

#   Failed test 'Inf as double->double'
#   at t/mapping/double.t line 55.
#          got: 'NV'
#     expected: 'PVNV'

#   Failed test '-Inf as double->double'
#   at t/mapping/double.t line 55.
#          got: 'NV'
#     expected: 'PVNV'

#   Failed test 'NaN as double->double'
#   at t/mapping/double.t line 55.
#          got: 'NV'
#     expected: 'PVNV'

#   Failed test 'Inf as BSON::Double->BSON::Double'
#   at t/mapping/double.t line 69.
#          got: 'NV'
#     expected: 'PVNV'

#   Failed test '-Inf as BSON::Double->BSON::Double'
#   at t/mapping/double.t line 69.
#          got: 'NV'
#     expected: 'PVNV'

#   Failed test 'NaN as BSON::Double->BSON::Double'
#   at t/mapping/double.t line 69.
#          got: 'NV'
#     expected: 'PVNV'
# Looks like you failed 6 tests of 39.
t/mapping/double.t ...............
Dubious, test returned 6 (wstat 1536, 0x600)
Failed 6/39 subtests

This is probably triggered by upgrading perl from 4:5.40.2-517.fc43 to 4:5.42.0-519.fc43.

Comment 1 Petr Pisar 2025-07-15 08:50:01 UTC
The warning is unrelated.

The failure appeared in 5.41.7 and this perldelta seems related:

        When assigning from an SVt_IV into a SVt_NV (or vice versa),
        providing that both are "bodyless" types, Perl_sv_setsv_flags will
        now just change the destination type to match the source type.
        Previously, an SVt_IV would have been upgraded to a SVt_PVNV to
        store an NV, and an SVt_NV would have been upgraded to a SVt_PVIV to
        store an IV. This change prevents the need to allocate - and later
        free - the relevant body struct.

That probably corresponds to perl commit fbebf96ce083dc15b63c04d5695997d6e2657b03 ("Perl_sv_setsv_flags: handle mixed IV and NV fast case").


When minimizing the failing test too much:

  my $hash = decode( encode( { A => unpack("d<",pack("H*","000000000000f0ff")) } ) );
  is( ref(B::svref_2object( \$hash->{A} )), 'B::PVNV', "double->double" );

the type becomes NV not only on perl 5.42.0 but also on perl 5.40.2.

If one calls:

  my $hash2 = decode( encode( { A => 3.14159 } ), wrap_numbers => 1);

before the test, the test returns PVPN on old perl.

I conclude the test or the BSON code builds on a side effect of the interpreter implementation which does not hold true anymore.

Normally I would adjust the test, but here BSON task is to reproduce Perl data structures and it does not reproduce them anymore.

I'm keen to remove perl-BSON and perl-Mongo from Rawhide. It's unmaintained since 2020 by upstream.

Comment 2 Petr Pisar 2025-07-15 08:56:41 UTC
Actually BSON::decode(, wrap_numbers => 1) is documented to "ensure fields can round-trip if unmodified". So any decoding without wrap_numbers == 1 does not guarantee preserving the type. Maybe the change in the decoding is acceptable.

Comment 3 Petr Pisar 2025-07-15 09:21:35 UTC
Actually new perl behaves better: Input in the test is NV. Output in the new perl is also NV, while in the old perl it was PVNV.


Note You need to log in before you can comment on or make changes to this bug.