Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Sereal-Encoder for openSUSE:Factory checked in at 2022-09-22 17:45:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Sereal-Encoder (Old) and /work/SRC/openSUSE:Factory/.perl-Sereal-Encoder.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Sereal-Encoder" Thu Sep 22 17:45:09 2022 rev:13 rq:1005412 version:5.001 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Sereal-Encoder/perl-Sereal-Encoder.changes 2022-08-16 17:08:33.692024838 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Sereal-Encoder.new.2275/perl-Sereal-Encoder.changes 2022-09-22 17:45:10.658617419 +0200 @@ -1,0 +2,6 @@ +Sun Sep 4 03:13:01 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 5.001 + see /usr/share/doc/packages/perl-Sereal-Encoder/Changes + +------------------------------------------------------------------- Old: ---- Sereal-Encoder-4.025.tar.gz New: ---- Sereal-Encoder-5.001.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Sereal-Encoder.spec ++++++ --- /var/tmp/diff_new_pack.RcdIBC/_old 2022-09-22 17:45:13.294621499 +0200 +++ /var/tmp/diff_new_pack.RcdIBC/_new 2022-09-22 17:45:13.302621511 +0200 @@ -18,7 +18,7 @@ %define cpan_name Sereal-Encoder Name: perl-Sereal-Encoder -Version: 4.025 +Version: 5.001 Release: 0 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Binary serialization module for Perl (encoder part) @@ -29,7 +29,7 @@ BuildRequires: perl-macros BuildRequires: perl(ExtUtils::MakeMaker) >= 7.0 BuildRequires: perl(ExtUtils::ParseXS) >= 2.21 -BuildRequires: perl(Sereal::Decoder) >= 4.002 +BuildRequires: perl(Sereal::Decoder) >= 5.000 BuildRequires: perl(Test::Deep) BuildRequires: perl(Test::Differences) BuildRequires: perl(Test::LongString) ++++++ Sereal-Encoder-4.025.tar.gz -> Sereal-Encoder-5.001.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/Changes new/Sereal-Encoder-5.001/Changes --- old/Sereal-Encoder-4.025/Changes 2022-07-28 13:57:13.000000000 +0200 +++ new/Sereal-Encoder-5.001/Changes 2022-09-03 15:37:06.000000000 +0200 @@ -1,10 +1,39 @@ Revision history for Perl extension Sereal-Encoder **************************************************************** -* Warning: For a seamless upgrade, upgrade to version 4 * -* of the decoder before upgrading to version 4 of the * +* Warning: For a seamless upgrade, upgrade to version 5 * +* of the decoder before upgrading to version 5 of the * * encoder! * **************************************************************** +5.001 + * First official release of protocol 5. Better support for non + standard NV types. Support for the new Perl 5.36 bools. + Upgrade *Sereal::Decoder* FIRST. + +5.000_002 + * Prerelease CPAN testing. Build fixes for quadmath and + longdouble perls. Certain tests were failing with the old + versions which were subtly broken on quadmath or longdouble + machines. These tests are now skipped on these builds. You + will not be able to fully test this platform until you install + the Decoder, and then install the Encoder. + +5.000_001 + * Prerelease CPAN testing for 5.000_000. + +5.000_000 Tue Aug 30, 2022 + * Better handling of floating point values + * Support quadmath __float128 values as FLOAT_128. + * Better longdouble support. + * Add encoder option 'use_standard_double' which avoids + use of LONG_DOUBLE and FLOAT_128 and forces doubles + to go to the wire as DOUBLE instead. By default we use + the native double for back compat. + * Add support for YES and NO tags, to match the new booleans + we have in Perl. JSON this is for you. Requires Perl 5.36. + +--- + 4.025 Thr Jul 28, 2022 * Release with build fixes for the Decoder under threaded perls and MANIFEST update. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/Encoder.xs new/Sereal-Encoder-5.001/Encoder.xs --- old/Sereal-Encoder-4.025/Encoder.xs 2022-02-18 05:14:23.000000000 +0100 +++ new/Sereal-Encoder-5.001/Encoder.xs 2022-08-30 18:58:18.000000000 +0200 @@ -189,6 +189,7 @@ SRL_INIT_OPTION( SRL_ENC_OPT_IDX_UNDEF_UNKNOWN, SRL_ENC_OPT_STR_UNDEF_UNKNOWN ); SRL_INIT_OPTION( SRL_ENC_OPT_IDX_USE_PROTOCOL_V1, SRL_ENC_OPT_STR_USE_PROTOCOL_V1 ); SRL_INIT_OPTION( SRL_ENC_OPT_IDX_WARN_UNKNOWN, SRL_ENC_OPT_STR_WARN_UNKNOWN ); + SRL_INIT_OPTION( SRL_ENC_OPT_IDX_USE_STANDARD_DOUBLE, SRL_ENC_OPT_STR_USE_STANDARD_DOUBLE ); } #if USE_CUSTOM_OPS { @@ -306,5 +307,3 @@ } PTABLE_iter_free(iter); PTABLE_free(tbl); - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/MANIFEST new/Sereal-Encoder-5.001/MANIFEST --- old/Sereal-Encoder-4.025/MANIFEST 2022-07-28 14:05:01.000000000 +0200 +++ new/Sereal-Encoder-5.001/MANIFEST 2022-09-03 15:40:03.000000000 +0200 @@ -112,6 +112,23 @@ t/700_roundtrip/v4/zlib_force.t t/700_roundtrip/v4/zstd.t t/700_roundtrip/v4/zstd_force.t +t/700_roundtrip/v5/dedudep_strings.t +t/700_roundtrip/v5/freeze_thaw.t +t/700_roundtrip/v5/plain.t +t/700_roundtrip/v5/plain_canon.t +t/700_roundtrip/v5/readonly.t +t/700_roundtrip/v5/snappy.t +t/700_roundtrip/v5/snappy_and_warn_unknown.t +t/700_roundtrip/v5/snappy_canon.t +t/700_roundtrip/v5/snappy_incr.t +t/700_roundtrip/v5/snappy_incr_canon.t +t/700_roundtrip/v5/sort_keys.t +t/700_roundtrip/v5/sort_keys_perl.t +t/700_roundtrip/v5/sort_keys_perl_rev.t +t/700_roundtrip/v5/zlib.t +t/700_roundtrip/v5/zlib_force.t +t/700_roundtrip/v5/zstd.t +t/700_roundtrip/v5/zstd_force.t t/800_threads.t t/900_reentrancy.t t/data/corpus diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/META.json new/Sereal-Encoder-5.001/META.json --- old/Sereal-Encoder-4.025/META.json 2022-07-28 14:05:01.000000000 +0200 +++ new/Sereal-Encoder-5.001/META.json 2022-09-03 15:40:03.000000000 +0200 @@ -53,7 +53,7 @@ "File::Spec" : "0", "Hash::Util" : "0", "Scalar::Util" : "0", - "Sereal::Decoder" : "4.002", + "Sereal::Decoder" : "5.000", "Test::Deep" : "0", "Test::Differences" : "0", "Test::LongString" : "0", @@ -72,6 +72,6 @@ "url" : "git://github.com/Sereal/Sereal.git" } }, - "version" : "4.025", - "x_serialization_backend" : "JSON::PP version 4.07" + "version" : "5.001", + "x_serialization_backend" : "JSON::PP version 4.11" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/META.yml new/Sereal-Encoder-5.001/META.yml --- old/Sereal-Encoder-4.025/META.yml 2022-07-28 14:05:01.000000000 +0200 +++ new/Sereal-Encoder-5.001/META.yml 2022-09-03 15:40:03.000000000 +0200 @@ -10,7 +10,7 @@ File::Spec: '0' Hash::Util: '0' Scalar::Util: '0' - Sereal::Decoder: '4.002' + Sereal::Decoder: '5.000' Test::Deep: '0' Test::Differences: '0' Test::LongString: '0' @@ -35,5 +35,5 @@ resources: bugtracker: https://github.com/Sereal/Sereal/issues repository: git://github.com/Sereal/Sereal.git -version: '4.025' +version: '5.001' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/Makefile.PL new/Sereal-Encoder-5.001/Makefile.PL --- old/Sereal-Encoder-4.025/Makefile.PL 2022-07-28 13:04:56.000000000 +0200 +++ new/Sereal-Encoder-5.001/Makefile.PL 2022-08-30 18:57:40.000000000 +0200 @@ -66,7 +66,7 @@ 'File::Spec' => '0', 'Hash::Util' => '0', 'Scalar::Util' => '0', - 'Sereal::Decoder' => '4.002', + 'Sereal::Decoder' => '5.000', 'Test::Deep' => '0', 'Test::Differences' => '0', 'Test::LongString' => '0', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/author_tools/hobodecoder.pl new/Sereal-Encoder-5.001/author_tools/hobodecoder.pl --- old/Sereal-Encoder-4.025/author_tools/hobodecoder.pl 2022-02-20 04:51:47.000000000 +0100 +++ new/Sereal-Encoder-5.001/author_tools/hobodecoder.pl 2022-08-30 18:57:40.000000000 +0200 @@ -112,7 +112,7 @@ $hlen= length($done); } -my ( $len_f, $len_d, $len_D ); +my ( $len_f, $len_d, $len_D, $len_F ); sub parse_float { $len_f ||= length( pack( "f", 0 ) ); @@ -121,6 +121,14 @@ return unpack( "f", $v ); } +sub parse_float_128 { + $len_F ||= length( pack( "F", 0 ) ); + my $v= _chop_data_prefix($len_F); + $done .= $v; + return unpack( "F", $v ); +} + + sub parse_double { $len_d ||= length( pack( "d", 0 ) ); my $v= _chop_data_prefix($len_d); @@ -190,6 +198,9 @@ elsif ( $o == SRL_HDR_LONG_DOUBLE ) { printf "LONG_DOUBLE(%f)\n", parse_long_double(); } + elsif ( $o == SRL_HDR_FLOAT_128 ) { + printf "FLOAT_128(%f)\n", parse_float_128(); + } elsif ( $o == SRL_HDR_REFN ) { printf "REFN\n"; parse_sv( $ind . " " ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/inc/Sereal/BuildTools.pm new/Sereal-Encoder-5.001/inc/Sereal/BuildTools.pm --- old/Sereal-Encoder-4.025/inc/Sereal/BuildTools.pm 2022-02-20 05:05:20.000000000 +0100 +++ new/Sereal-Encoder-5.001/inc/Sereal/BuildTools.pm 2022-08-30 19:40:40.000000000 +0200 @@ -145,6 +145,13 @@ grep { exists $ENV{$_} } ( qw(NOINLINE DEBUG MEMDEBUG NDEBUG), @defs ) ); $defines .= " -DNDEBUG" unless $ENV{DEBUG}; + + if ($Config{usequadmath}) { + $defines .= " -DHAS_QUADMATH"; + } elsif ($Config{uselongdouble}) { + $defines .= " -DHAS_LONGDOUBLE"; + } + if ( $Config{osname} eq 'hpux' && not $Config{gccversion} ) { # HP-UX cc does not support inline. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/lib/Sereal/Encoder/Constants.pm new/Sereal-Encoder-5.001/lib/Sereal/Encoder/Constants.pm --- old/Sereal-Encoder-4.025/lib/Sereal/Encoder/Constants.pm 2022-07-28 13:57:13.000000000 +0200 +++ new/Sereal-Encoder-5.001/lib/Sereal/Encoder/Constants.pm 2022-09-03 15:37:12.000000000 +0200 @@ -4,7 +4,7 @@ require Exporter; our @ISA= qw(Exporter); -our $VERSION= '4.025'; # Don't forget to update the TestCompat set for testing against installed encoders! +our $VERSION= '5.001'; # Don't forget to update the TestCompat set for testing against installed encoders! our ( @EXPORT_OK, %DEFINE, %TAG_INFO_HASH, @TAG_INFO_ARRAY ); @@ -26,6 +26,7 @@ "SRL_HDR_EXTEND" => 62, "SRL_HDR_FALSE" => 58, "SRL_HDR_FLOAT" => 34, + "SRL_HDR_FLOAT_128" => 56, "SRL_HDR_HASH" => 42, "SRL_HDR_HASHREF" => 80, "SRL_HDR_HASHREF_HIGH" => 95, @@ -35,6 +36,7 @@ "SRL_HDR_NEG" => 16, "SRL_HDR_NEG_HIGH" => 31, "SRL_HDR_NEG_LOW" => 16, + "SRL_HDR_NO" => 52, "SRL_HDR_OBJECT" => 44, "SRL_HDR_OBJECTV" => 45, "SRL_HDR_OBJECTV_FREEZE" => 51, @@ -47,9 +49,9 @@ "SRL_HDR_REFN" => 40, "SRL_HDR_REFP" => 41, "SRL_HDR_REGEXP" => 49, - "SRL_HDR_RESERVED" => 52, - "SRL_HDR_RESERVED_HIGH" => 56, - "SRL_HDR_RESERVED_LOW" => 52, + "SRL_HDR_RESERVED" => 54, + "SRL_HDR_RESERVED_HIGH" => 55, + "SRL_HDR_RESERVED_LOW" => 54, "SRL_HDR_SHORT_BINARY" => 96, "SRL_HDR_SHORT_BINARY_HIGH" => 127, "SRL_HDR_SHORT_BINARY_LOW" => 96, @@ -59,16 +61,17 @@ "SRL_HDR_UNDEF" => 37, "SRL_HDR_VARINT" => 32, "SRL_HDR_WEAKEN" => 48, + "SRL_HDR_YES" => 53, "SRL_HDR_ZIGZAG" => 33, "SRL_MAGIC_STRING" => "=srl", "SRL_MAGIC_STRING_HIGHBIT" => "=\363rl", - "SRL_MAGIC_STRING_HIGHBIT_UINT_BE" => "1039364716", - "SRL_MAGIC_STRING_HIGHBIT_UINT_LE" => "1819472701", + "SRL_MAGIC_STRING_HIGHBIT_UINT_BE" => 1039364716, + "SRL_MAGIC_STRING_HIGHBIT_UINT_LE" => 1819472701, "SRL_MAGIC_STRING_HIGHBIT_UTF8" => "=\303\263rl", - "SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_BE" => "1036235634", - "SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_LE" => "1924383549", - "SRL_MAGIC_STRING_UINT_BE" => "1030976108", - "SRL_MAGIC_STRING_UINT_LE" => "1819439933", + "SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_BE" => 1036235634, + "SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_LE" => 1924383549, + "SRL_MAGIC_STRING_UINT_BE" => 1030976108, + "SRL_MAGIC_STRING_UINT_LE" => 1819439933, "SRL_MAGIC_STRLEN" => 4, "SRL_MASK_ARRAYREF_COUNT" => 15, "SRL_MASK_HASHREF_COUNT" => 15, @@ -83,7 +86,7 @@ "SRL_PROTOCOL_ENCODING_ZSTD" => 64, "SRL_PROTOCOL_HDR_CONTINUE" => 8, "SRL_PROTOCOL_HDR_USER_DATA" => 1, - "SRL_PROTOCOL_VERSION" => 4, + "SRL_PROTOCOL_VERSION" => 5, "SRL_PROTOCOL_VERSION_BITS" => 4, "SRL_PROTOCOL_VERSION_MASK" => 15 ); @@ -602,52 +605,48 @@ # autoupdated by Sereal.git:Perl/shared/author_tools/update_from_header.pl do not modify directly! { - "comment" => "reserved", - "masked" => 1, - "masked_val" => 0, - "name" => "RESERVED_0", - "type_name" => "RESERVED", + "comment" => "SvIsBOOL() == PL_No, 5.36 and later only (json false)", + "name" => "NO", + "type_name" => "NO", "type_value" => 52, "value" => 52 }, # autoupdated by Sereal.git:Perl/shared/author_tools/update_from_header.pl do not modify directly! { - "masked" => 1, - "masked_val" => 1, - "name" => "RESERVED_1", - "type_name" => "RESERVED", - "type_value" => 52, + "comment" => "SvIsBOOL() == PL_Yes, 5.36 and later only (json true)", + "name" => "YES", + "type_name" => "YES", + "type_value" => 53, "value" => 53 }, # autoupdated by Sereal.git:Perl/shared/author_tools/update_from_header.pl do not modify directly! { "masked" => 1, - "masked_val" => 2, - "name" => "RESERVED_2", + "masked_val" => 0, + "name" => "RESERVED_0", "type_name" => "RESERVED", - "type_value" => 52, + "type_value" => 54, "value" => 54 }, # autoupdated by Sereal.git:Perl/shared/author_tools/update_from_header.pl do not modify directly! { "masked" => 1, - "masked_val" => 3, - "name" => "RESERVED_3", + "masked_val" => 1, + "name" => "RESERVED_1", "type_name" => "RESERVED", - "type_value" => 52, + "type_value" => 54, "value" => 55 }, # autoupdated by Sereal.git:Perl/shared/author_tools/update_from_header.pl do not modify directly! { - "masked" => 1, - "masked_val" => 4, - "name" => "RESERVED_4", - "type_name" => "RESERVED", - "type_value" => 52, + "comment" => "quadmath _float128", + "name" => "FLOAT_128", + "type_name" => "FLOAT_128", + "type_value" => 56, "value" => 56 }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/lib/Sereal/Encoder.pm new/Sereal-Encoder-5.001/lib/Sereal/Encoder.pm --- old/Sereal-Encoder-4.025/lib/Sereal/Encoder.pm 2022-07-28 13:57:13.000000000 +0200 +++ new/Sereal-Encoder-5.001/lib/Sereal/Encoder.pm 2022-09-03 15:37:12.000000000 +0200 @@ -5,12 +5,14 @@ use Carp qw/croak/; use XSLoader; -our $VERSION= '4.025'; # Don't forget to update the TestCompat set for testing against installed decoders! +our $VERSION= '5.001'; # Don't forget to update the TestCompat set for testing against installed decoders! our $XS_VERSION= $VERSION; $VERSION= eval $VERSION; # not for public consumption, just for testing. ( my $num_version= $VERSION ) =~ s/_//; -my $TestCompat= [ map sprintf( "%.2f", $_ / 100 ), reverse( 400 .. int( $num_version * 100 ) ) ]; # compat with 4.00 to ... +my $TestCompat= [ map sprintf( "%.2f", $_ / 100 ), + reverse( 400 .. int( $num_version * 100 ) ) + ]; # compat with 4.00 to ... sub _test_compat { return ( @$TestCompat, $VERSION ) } # Make sure to keep these constants in sync with the C code in srl_encoder.c. @@ -436,6 +438,15 @@ I<Beware:> The test suite currently does not cover this option as well as it probably should. Patches welcome. +=head3 use_standard_double + +This option can be used to force Perls built with uselongdouble or quadmath +to use DOUBLE instead of the native floating point. This can be helpful +interoperating with Perls which do not support larger sized floats. Note +that "uselongdouble" means different things in different places, so this +option may be helpful for such builds. We do not enable this option by default +for backwards compatibility reasons, and because doing so would lose precision. + =head3 protocol_version Specifies the version of the Sereal protocol to emit. Valid are integers @@ -847,6 +858,13 @@ It is possible that a future release of the protocol will fix these issues. +=item Booleans + +As of Perl 5.36 and protocol version 5 Sereal now supports booleans. The new +tags SRL_HDR_YES and SRL_HDR_NO now represent perl bools, the old special +variables that SRL_HDR_TRUE and SRL_HDR_FALSE may still be generated, but beyond +being readonly these are equivalent to SRL_HDR_YES and SRL_HDR_NO. + =back =head1 BUGS, CONTACT AND SUPPORT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_common.h new/Sereal-Encoder-5.001/srl_common.h --- old/Sereal-Encoder-4.025/srl_common.h 2022-02-20 04:25:44.000000000 +0100 +++ new/Sereal-Encoder-5.001/srl_common.h 2022-08-30 20:51:38.000000000 +0200 @@ -14,6 +14,15 @@ #define expect_true(expr) expect((expr) != 0, 1) /* these defines are somewhat borrowed from miniz.c */ +#ifndef HAS_LONGDOUBLE +#define SRL_EXTENDED_PRECISION_LONG_DOUBLE 0 +#endif + +#ifdef HAS_QUADMATH +#define SRL_EXTENDED_PRECISION_LONG_DOUBLE 0 +#endif + +#define HAS_LONG_FLOAT (sizeof(NV) > sizeof(double)) #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__i386) || defined(__i486__) || defined(__i486) || defined(i386) || defined(__ia64__) || defined(__x86_64__) || defined(__x86_64) /* SRL_X86_OR_X64_CPU is only used to help set the below macros. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_encoder.c new/Sereal-Encoder-5.001/srl_encoder.c --- old/Sereal-Encoder-4.025/srl_encoder.c 2022-07-22 15:44:51.000000000 +0200 +++ new/Sereal-Encoder-5.001/srl_encoder.c 2022-09-01 13:17:05.000000000 +0200 @@ -194,11 +194,29 @@ #define DO_POK_REGEXP(enc, src, svt) /*no-op*/ #endif + + +#ifdef SvIsBOOL +#define _SRL_CHECK_BOOL(enc, src, svt) \ + if (enc->protocol_version >=5 && SvIsBOOL(src)) { \ + if (PV == PL_No) { \ + srl_buf_cat_char(&enc->buf, SRL_HDR_NO); \ + } else { \ + assert(PV == Pl_Yes); \ + srl_buf_cat_char(&enc->buf, SRL_HDR_YES); \ + } \ + } \ + else +#else +#define _SRL_CHECK_BOOL(enc, src, svt) +#endif + #define _SRL_IF_SIMPLE_DIRECT_DUMP_SV(enc, src, svt) \ if (SvPOK(src)) { \ STRLEN L; \ char *PV= SvPV(src, L); \ if ( SvIOK(src) ) { \ + _SRL_CHECK_BOOL(enc, src, svt) \ if ( SvIV(src) == 0 ) { \ if ( L == 1 && PV[0] == '0' ) { \ /* its a true 0 */ \ @@ -617,6 +635,10 @@ my_hv_fetchs(he, val, opt, SRL_ENC_OPT_IDX_MAX_RECURSION_DEPTH); if ( val && SvTRUE(val) ) enc->max_recursion_depth = SvUV(val); + + my_hv_fetchs(he, val, opt, SRL_ENC_OPT_IDX_USE_STANDARD_DOUBLE); + if ( val && SvTRUE(val) ) + SRL_ENC_SET_OPTION(enc, SRL_F_USE_STANDARD_DOUBLE); } else { /* SRL_F_SHARED_HASHKEYS on by default */ @@ -773,20 +795,37 @@ NV nv= SvNV(src); MS_VC6_WORKAROUND_VOLATILE float f= (float)nv; MS_VC6_WORKAROUND_VOLATILE double d= (double)nv; +#ifdef HAS_QUADMATH +#define LONG_FLOAT_MIN_VER 5 +#else +#define LONG_FLOAT_MIN_VER 4 +#endif /* TODO: this logic could be reworked to not duplicate so much code, which will help on win32 */ if ( f == nv || nv != nv ) { - BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(f)); /* heuristic: header + string + simple value */ + BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(f)); /* tag + payload */ srl_buf_cat_char_nocheck(&enc->buf, SRL_HDR_FLOAT); Copy((char *)&f, enc->buf.pos, sizeof(f), char); enc->buf.pos += sizeof(f); - } else if (d == nv) { - BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(d)); /* heuristic: header + string + simple value */ + } else if ( + !HAS_LONG_FLOAT || + d == nv || + SRL_ENC_HAVE_OPTION(enc,SRL_F_USE_STANDARD_DOUBLE) || + (enc->protocol_version < LONG_FLOAT_MIN_VER) + ) { + BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(d)); /* tag + payload */ srl_buf_cat_char_nocheck(&enc->buf, SRL_HDR_DOUBLE); Copy((char *)&d, enc->buf.pos, sizeof(d), char); enc->buf.pos += sizeof(d); } else { - BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(nv)); /* heuristic: header + string + simple value */ - srl_buf_cat_char_nocheck(&enc->buf, SRL_HDR_LONG_DOUBLE); + assert(HAS_LONG_FLOAT); + BUF_SIZE_ASSERT(&enc->buf, 1 + sizeof(nv)); /* tag + payload */ + srl_buf_cat_char_nocheck(&enc->buf, +#ifdef HAS_QUADMATH + SRL_HDR_FLOAT_128 +#else + SRL_HDR_LONG_DOUBLE +#endif + ); Copy((char *)&nv, enc->buf.pos, sizeof(nv), char); #if SRL_EXTENDED_PRECISION_LONG_DOUBLE /* x86 uses an 80 bit extended precision. on 64 bit machines @@ -1858,4 +1897,3 @@ } --enc->recursion_depth; } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_encoder.h new/Sereal-Encoder-5.001/srl_encoder.h --- old/Sereal-Encoder-4.025/srl_encoder.h 2022-02-18 05:14:23.000000000 +0100 +++ new/Sereal-Encoder-5.001/srl_encoder.h 2022-09-01 15:03:22.000000000 +0200 @@ -98,6 +98,7 @@ * set since we otherwise croak. Corresponds to the 'warn_unknown' option. */ #define SRL_F_WARN_UNKNOWN 0x00020UL + /* WARNING: * #define SRL_F_COMPRESS_SNAPPY 0x00040UL * #define SRL_F_COMPRESS_SNAPPY_INCREMENTAL 0x00080UL @@ -141,6 +142,8 @@ * #define SRL_F_COMPRESS_ZSTD 0x40000UL */ +#define SRL_F_USE_STANDARD_DOUBLE 0x80000UL + /* ==================================================================== * oper flags */ @@ -242,6 +245,9 @@ #define SRL_ENC_OPT_STR_WARN_UNKNOWN "warn_unknown" #define SRL_ENC_OPT_IDX_WARN_UNKNOWN 20 -#define SRL_ENC_OPT_COUNT 21 +#define SRL_ENC_OPT_STR_USE_STANDARD_DOUBLE "use_standard_double" +#define SRL_ENC_OPT_IDX_USE_STANDARD_DOUBLE 21 + +#define SRL_ENC_OPT_COUNT 22 #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_protocol.h new/Sereal-Encoder-5.001/srl_protocol.h --- old/Sereal-Encoder-4.025/srl_protocol.h 2020-02-02 12:33:20.000000000 +0100 +++ new/Sereal-Encoder-5.001/srl_protocol.h 2022-09-01 15:03:25.000000000 +0200 @@ -59,11 +59,11 @@ REGEXP | "1" | 49 | 0x31 | 0b00110001 | <PATTERN-STR-TAG> <MODIFIERS-STR-TAG> OBJECT_FREEZE | "2" | 50 | 0x32 | 0b00110010 | <STR-TAG> <ITEM-TAG> - class, object-item. Need to call "THAW" method on class after decoding OBJECTV_FREEZE | "3" | 51 | 0x33 | 0b00110011 | <OFFSET-VARINT> <ITEM-TAG> - (OBJECTV_FREEZE is to OBJECT_FREEZE as OBJECTV is to OBJECT) - RESERVED_0 | "4" | 52 | 0x34 | 0b00110100 | reserved - RESERVED_1 | "5" | 53 | 0x35 | 0b00110101 | - RESERVED_2 | "6" | 54 | 0x36 | 0b00110110 | - RESERVED_3 | "7" | 55 | 0x37 | 0b00110111 | - RESERVED_4 | "8" | 56 | 0x38 | 0b00111000 | reserved + NO | "4" | 52 | 0x34 | 0b00110100 | SvIsBOOL() == PL_No, 5.36 and later only (json false) + YES | "5" | 53 | 0x35 | 0b00110101 | SvIsBOOL() == PL_Yes, 5.36 and later only (json true) + RESERVED_0 | "6" | 54 | 0x36 | 0b00110110 | + RESERVED_1 | "7" | 55 | 0x37 | 0b00110111 | + FLOAT_128 | "8" | 56 | 0x38 | 0b00111000 | quadmath _float128 CANONICAL_UNDEF | "9" | 57 | 0x39 | 0b00111001 | undef (PL_sv_undef) - "the" Perl undef (see notes) FALSE | ":" | 58 | 0x3a | 0b00111010 | false (PL_sv_no) TRUE | ";" | 59 | 0x3b | 0b00111011 | true (PL_sv_yes) @@ -155,7 +155,7 @@ #define SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_LE 0x72B3C33D /* first four bytes of SRL_MAGIC_STRING encoded as UTF8, little endian */ #define SRL_MAGIC_STRING_HIGHBIT_UTF8_UINT_BE 0x3DC3B372 /* first four bytes of SRL_MAGIC_STRING encoded as UTF8, big endian */ -#define SRL_PROTOCOL_VERSION ( 4 ) +#define SRL_PROTOCOL_VERSION ( 5 ) #define SRL_PROTOCOL_VERSION_BITS ( 4 ) /* how many bits we use for the version, the rest go to the encoding */ #define SRL_PROTOCOL_VERSION_MASK ( ( 1 << SRL_PROTOCOL_VERSION_BITS ) - 1 ) @@ -211,12 +211,16 @@ #define SRL_HDR_OBJECT_FREEZE ((U8)50) /* <STR-TAG> <ITEM-TAG> - class, object-item. Need to call "THAW" method on class after decoding */ #define SRL_HDR_OBJECTV_FREEZE ((U8)51) /* <OFFSET-VARINT> <ITEM-TAG> - (OBJECTV_FREEZE is to OBJECT_FREEZE as OBJECTV is to OBJECT) */ +#define SRL_HDR_NO ((U8)52) /* SvIsBOOL() == PL_No, 5.36 and later only (json false) */ +#define SRL_HDR_YES ((U8)53) /* SvIsBOOL() == PL_Yes, 5.36 and later only (json true)*/ + /* Note: Can do reserved check with a range now, but as we start using * them, might have to explicit == check later. */ -#define SRL_HDR_RESERVED ((U8)52) /* reserved */ -#define SRL_HDR_RESERVED_LOW ((U8)52) -#define SRL_HDR_RESERVED_HIGH ((U8)56) +#define SRL_HDR_RESERVED ((U8)54) +#define SRL_HDR_RESERVED_LOW ((U8)54) +#define SRL_HDR_RESERVED_HIGH ((U8)55) +#define SRL_HDR_FLOAT_128 ((U8)56) /* quadmath _float128 */ #define SRL_HDR_CANONICAL_UNDEF ((U8)57) /* undef (PL_sv_undef) - "the" Perl undef (see notes) */ #define SRL_HDR_FALSE ((U8)58) /* false (PL_sv_no) */ #define SRL_HDR_TRUE ((U8)59) /* true (PL_sv_yes) */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_reader_error.h new/Sereal-Encoder-5.001/srl_reader_error.h --- old/Sereal-Encoder-4.025/srl_reader_error.h 2017-10-03 19:46:10.000000000 +0200 +++ new/Sereal-Encoder-5.001/srl_reader_error.h 2022-09-01 13:17:05.000000000 +0200 @@ -15,8 +15,8 @@ #define SRL_RDR_ERRORf4(buf, fmt, var1, var2, var3, var4) croak(SRL_RDR_BASE_ERROR_FORMAT(fmt), (var1), (var2), (var3), (var4), SRL_RDR_BASE_ERROR_ARGS((buf))) #define SRL_RDR_ERROR_UNIMPLEMENTED(buf, tag, str) SRL_RDR_ERRORf3((buf), "Tag %u (0x%x) '%s' is unimplemented", (tag), (tag), (str)) -#define SRL_RDR_ERROR_UNEXPECTED(buf, tag, msg) SRL_RDR_ERRORf2((buf), "Unexpected tag SRL_HDR_%s while expecting %s", SRL_TAG_NAME((tag)), (msg)) -#define SRL_RDR_ERROR_BAD_COPY(buf, tag) SRL_RDR_ERRORf1((buf), "While processing tag SRL_HDR_%s encountered a bad COPY tag", SRL_TAG_NAME((tag))) +#define SRL_RDR_ERROR_UNEXPECTED(buf, tag, msg) SRL_RDR_ERRORf3((buf), "Unexpected tag SRL_HDR_%s (%02x) while expecting %s", SRL_TAG_NAME((tag)), (tag), (msg)) +#define SRL_RDR_ERROR_BAD_COPY(buf, tag) SRL_RDR_ERRORf2((buf), "While processing tag SRL_HDR_%s (%02x) encountered a bad COPY tag", SRL_TAG_NAME((tag)),(tag)) #define SRL_RDR_ERROR_EOF(buf, msg) SRL_RDR_ERRORf1((buf), "Premature end of document while expecting %s", (msg)); #define SRL_RDR_ERROR_REFUSE_OBJECT(buf) SRL_RDR_ERROR((buf), "Encountered object in input, but the 'refuse_objects' option is in effect"); #define SRL_RDR_ERROR_PANIC(buf, msg) SRL_RDR_ERRORf1((buf), "Panic: %s", msg); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/srl_taginfo.h new/Sereal-Encoder-5.001/srl_taginfo.h --- old/Sereal-Encoder-4.025/srl_taginfo.h 2020-02-02 18:25:40.000000000 +0100 +++ new/Sereal-Encoder-5.001/srl_taginfo.h 2022-09-01 11:12:36.000000000 +0200 @@ -63,11 +63,11 @@ "REGEXP", /* "1" 49 0x31 0b00110001 */ "OBJECT_FREEZE", /* "2" 50 0x32 0b00110010 */ "OBJECTV_FREEZE", /* "3" 51 0x33 0b00110011 */ - "RESERVED_0", /* "4" 52 0x34 0b00110100 */ - "RESERVED_1", /* "5" 53 0x35 0b00110101 */ - "RESERVED_2", /* "6" 54 0x36 0b00110110 */ - "RESERVED_3", /* "7" 55 0x37 0b00110111 */ - "RESERVED_4", /* "8" 56 0x38 0b00111000 */ + "NO", /* "4" 52 0x34 0b00110100 */ + "YES", /* "5" 53 0x35 0b00110101 */ + "RESERVED_0", /* "6" 54 0x36 0b00110110 */ + "RESERVED_1", /* "7" 55 0x37 0b00110111 */ + "FLOAT_128", /* "8" 56 0x38 0b00111000 */ "CANONICAL_UNDEF", /* "9" 57 0x39 0b00111001 */ "FALSE", /* ":" 58 0x3a 0b00111010 */ "TRUE", /* ";" 59 0x3b 0b00111011 */ @@ -173,11 +173,8 @@ #define SRL_HDR_NEG_3 29 #define SRL_HDR_NEG_2 30 #define SRL_HDR_NEG_1 31 -#define SRL_HDR_RESERVED_0 52 -#define SRL_HDR_RESERVED_1 53 -#define SRL_HDR_RESERVED_2 54 -#define SRL_HDR_RESERVED_3 55 -#define SRL_HDR_RESERVED_4 56 +#define SRL_HDR_RESERVED_0 54 +#define SRL_HDR_RESERVED_1 55 #define SRL_HDR_ARRAYREF_0 64 #define SRL_HDR_ARRAYREF_1 65 #define SRL_HDR_ARRAYREF_2 66 @@ -321,10 +318,7 @@ #define CASE_SRL_HDR_RESERVED \ case SRL_HDR_RESERVED_0: \ - case SRL_HDR_RESERVED_1: \ - case SRL_HDR_RESERVED_2: \ - case SRL_HDR_RESERVED_3: \ - case SRL_HDR_RESERVED_4 + case SRL_HDR_RESERVED_1 #define CASE_SRL_HDR_SHORT_BINARY \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/002_have_enc_and_dec.t new/Sereal-Encoder-5.001/t/002_have_enc_and_dec.t --- old/Sereal-Encoder-4.025/t/002_have_enc_and_dec.t 2020-02-02 18:25:40.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/002_have_enc_and_dec.t 2022-09-02 19:58:47.000000000 +0200 @@ -10,8 +10,8 @@ if !-d 't'; } use Sereal::TestSet qw(:all); - -if ( have_encoder_and_decoder() ) { +my $problem= check_for_dependency_issues(); +if ( !$problem or $problem!~/is missing/ ) { plan tests => 1; } else { @@ -20,5 +20,8 @@ diag "Testing with both encoder and decoder."; diag "Sereal::Decoder v$Sereal::Decoder::VERSION"; diag "Sereal::Encoder v$Sereal::Encoder::VERSION"; -ok(1); - +is($problem,"","There should be no Encoder/Decoder dependency problems.") + or diag "If this test fails it means you need to upgrade Sereal::Decoder first!\n" + . "You are strongly advised to follow this guidance, upgrading the Encoder\n" + . "before you upgrade the Decoder may lead to serious problems\n\n" + . "YOU HAVE BEEN WARNED.\n\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/004_testset.t new/Sereal-Encoder-5.001/t/004_testset.t --- old/Sereal-Encoder-4.025/t/004_testset.t 2020-02-02 18:25:40.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/004_testset.t 2022-09-01 13:17:05.000000000 +0200 @@ -17,14 +17,14 @@ use Test::More; # needs more tests -ok( _deep_cmp( ["x"], {} ) ); -ok( _deep_cmp( { "x" => 1 }, { "y" => 1 } ) ); -ok( _deep_cmp( { "x" => 1 }, { "x" => 2 } ) ); -ok( _deep_cmp( { "x" => 1 }, { "x" => 2, "y" => 1 } ) ); -ok( !_deep_cmp( { "x" => 1 }, { "x" => 1 } ) ); -ok( !_deep_cmp( ["x"], ["x"] ) ); -ok( _deep_cmp( ["x"], [ "y", "p" ] ) ); -ok( _deep_cmp( [ "a", "x" ], ["y"] ) ); +ok( _test_deep_cmp( ["x"], {} ) ); +ok( _test_deep_cmp( { "x" => 1 }, { "y" => 1 } ) ); +ok( _test_deep_cmp( { "x" => 1 }, { "x" => 2 } ) ); +ok( _test_deep_cmp( { "x" => 1 }, { "x" => 2, "y" => 1 } ) ); +ok( !_test_deep_cmp( { "x" => 1 }, { "x" => 1 } ) ); +ok( !_test_deep_cmp( ["x"], ["x"] ) ); +ok( _test_deep_cmp( ["x"], [ "y", "p" ] ) ); +ok( _test_deep_cmp( [ "a", "x" ], ["y"] ) ); ok( _cmp_str( "foo", "bar" ) ); ok( !_cmp_str( "aaa", "aaa" ) ); ok( _cmp_str( "aaacowbbb", "aaadogbb" ) ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/005_flags.t new/Sereal-Encoder-5.001/t/005_flags.t --- old/Sereal-Encoder-4.025/t/005_flags.t 2020-02-02 18:25:40.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/005_flags.t 2022-09-01 13:17:05.000000000 +0200 @@ -24,6 +24,7 @@ sub run_tests { my ( $extra_name, $opt_hash )= @_; + $opt_hash->{protocol_version} = 3; my $encoder= Sereal::Encoder->new($opt_hash); my $decoder= Sereal::Decoder->new($opt_hash); @@ -86,4 +87,3 @@ # hobodecode($out); } } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/010_desperate.t new/Sereal-Encoder-5.001/t/010_desperate.t --- old/Sereal-Encoder-4.025/t/010_desperate.t 2022-02-18 05:14:23.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/010_desperate.t 2022-08-30 20:51:38.000000000 +0200 @@ -32,7 +32,7 @@ sub run_tests { my ( $extra_name, $opt_hash )= @_; - setup_tests(4); + setup_tests(5); foreach my $bt (@BasicTests) { my ( undef, $expect, $name, @alternate )= @$bt; @@ -81,4 +81,3 @@ }; } } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/190_customop.t new/Sereal-Encoder-5.001/t/190_customop.t --- old/Sereal-Encoder-4.025/t/190_customop.t 2022-02-18 05:14:23.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/190_customop.t 2022-08-30 20:51:38.000000000 +0200 @@ -9,5 +9,5 @@ my $srl_encoder= Sereal::Encoder->new(); my $enc= sereal_encode_with_object($srl_encoder,[]); -is($enc,"=\363rl\4\0\@", "check that sereal_encode_with_object works"); +is($enc,"=\363rl\5\0\@", "check that sereal_encode_with_object works"); pass("did not segfault!") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/dedudep_strings.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/dedudep_strings.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/dedudep_strings.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/dedudep_strings.t 2022-09-01 14:55:52.000000000 +0200 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'dedupe_strings', { dedupe_strings => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/freeze_thaw.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/freeze_thaw.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/freeze_thaw.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/freeze_thaw.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'freeze-thaw', { freeze_callbacks => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/plain.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/plain.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/plain.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/plain.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,29 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $version; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests("plain"); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/plain_canon.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/plain_canon.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/plain_canon.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/plain_canon.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,28 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006; +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder (want 3.001006)'; +} +else { + run_roundtrip_tests( "plain_canonical", { canonical => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/readonly.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/readonly.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/readonly.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/readonly.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'readonly', { set_readonly => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'snappy', { snappy => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_and_warn_unknown.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_and_warn_unknown.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_and_warn_unknown.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_and_warn_unknown.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,45 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + my $e= Sereal::Encoder->new(); + my $d= Sereal::Decoder->new(); + + my $out; + my $payload= [ 'abcd' x 1024 ]; + my $ok= eval { $out= $e->encode($payload); 1 }; + my $err= $@ || 'Zombie error'; + ok( $ok, "snappy_incr and warn_unknown makes CODE encoding not fail" ); + + my $decoded; + $ok= eval { $decoded= $d->decode($out); 1 }; + $err= $@ || 'Zombie error'; + ok( $ok, "snappy_incr and warn_unknown produced decodable output" ) + or do { + diag($err); + hobodecode($out) if $ENV{DEBUG_SEREAL}; + }; + + is_deeply( $decoded, $payload, 'results matches' ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_canon.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_canon.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_canon.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_canon.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,28 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006; +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder (want 3.001006)'; +} +else { + run_roundtrip_tests( 'snappy_canon', { snappy => 1, canonical => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_incr.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_incr.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_incr.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_incr.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'snappy_incr', { snappy_incr => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_incr_canon.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_incr_canon.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/snappy_incr_canon.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/snappy_incr_canon.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,28 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +$ok= 0 if $ok and $Sereal::Encoder::VERSION < 3.001006; +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder (want 3.001006)'; +} +else { + run_roundtrip_tests( 'snappy_incr_canon', { snappy_incr => 1, canonical => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys.t 2022-09-01 12:10:09.000000000 +0200 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'sort_keys', { sort_keys => 1 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys_perl.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys_perl.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys_perl.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys_perl.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'sort_keys', { sort_keys => 2 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys_perl_rev.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys_perl_rev.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/sort_keys_perl_rev.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/sort_keys_perl_rev.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,27 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( 'sort_keys', { sort_keys => 3 } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zlib.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zlib.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zlib.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zlib.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,31 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( + 'zlib', + { + compress => Sereal::Encoder::SRL_ZLIB(), + } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zlib_force.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zlib_force.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zlib_force.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zlib_force.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,32 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( + 'zlib_force', + { + compress => Sereal::Encoder::SRL_ZLIB(), + compress_threshold => 0, + } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zstd.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zstd.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zstd.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zstd.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,31 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( + 'zstd', + { + compress => Sereal::Encoder::SRL_ZSTD(), + } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zstd_force.t new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zstd_force.t --- old/Sereal-Encoder-4.025/t/700_roundtrip/v5/zstd_force.t 1970-01-01 01:00:00.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/700_roundtrip/v5/zstd_force.t 2020-02-02 18:25:40.000000000 +0100 @@ -0,0 +1,32 @@ +#!perl +use strict; +use warnings; +use Data::Dumper; +use File::Spec; + +use lib File::Spec->catdir(qw(t lib)); + +BEGIN { + lib->import('lib') + if !-d 't'; +} + +use Sereal::TestSet qw(:all); +use Test::More; + +my $ok= have_encoder_and_decoder(); +if ( not $ok ) { + plan skip_all => 'Did not find right version of encoder'; +} +else { + run_roundtrip_tests( + 'zstd_force', + { + compress => Sereal::Encoder::SRL_ZSTD(), + compress_threshold => 0, + } ); +} + +pass(); +done_testing(); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/800_threads.t new/Sereal-Encoder-5.001/t/800_threads.t --- old/Sereal-Encoder-4.025/t/800_threads.t 2022-02-18 05:14:23.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/800_threads.t 2022-08-30 20:51:38.000000000 +0200 @@ -5,7 +5,7 @@ BEGIN { use Config; - if ( !$Config{'useithreads'} ) { + if ( !$Config{'useithreads'} and !$Config{'usethreads'} ) { print("1..0 # SKIP Perl not compiled with 'useithreads'\n"); exit(0); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Sereal-Encoder-4.025/t/lib/Sereal/TestSet.pm new/Sereal-Encoder-5.001/t/lib/Sereal/TestSet.pm --- old/Sereal-Encoder-4.025/t/lib/Sereal/TestSet.pm 2022-02-20 05:05:20.000000000 +0100 +++ new/Sereal-Encoder-5.001/t/lib/Sereal/TestSet.pm 2022-09-02 20:39:47.000000000 +0200 @@ -82,11 +82,13 @@ integer short_string varint array array_fbit hash dump_bless have_encoder_and_decoder + check_for_dependency_issues run_roundtrip_tests write_test_files $use_objectv setup_tests _deep_cmp + _test_deep_cmp _test _cmp_str ); @@ -672,42 +674,59 @@ } sub have_encoder_and_decoder { + return !check_for_dependency_issues(@_); +} + +sub check_for_dependency_issues { my ($min_v)= @_; # $Class is the already-loaded class, so the one we're testing my @need= $Class =~ /Encoder/ ? ("Decoder") : $Class =~ /Decoder/ ? ("Encoder") - : ( "Encoder", "Decoder" ); + : ( "Decoder", "Encoder" ); my @need_class= ( $Class, map { "Sereal::$_" } @need ); foreach my $class (@need_class) { eval "use $class; 1" or do { - note( "Could not locate $class for testing" . ( $@ ? " (Exception: $@)" : "" ) ); - return (); + note( "Could not locate $class for testing" . ( $@ ? " (Exception: $@)" : "" ) ); + return "$Class is missing."; }; my $cmp_v= $class->VERSION; + if (!defined $min_v and $Class eq $class) { + if ($class eq "Sereal::Encoder") { + $min_v= $cmp_v; + } elsif ($class eq "Sereal::Decoder") { + if ($0=~m!/v(\d+)/!) { + $min_v= $1; + if ($Config{usequadmath} || $Config{uselongdouble}) { + $min_v= 5; + } + } + } + } + if ( $min_v and $cmp_v < $min_v ) { diag( "Could not load correct version of $class for testing " . "(got: $cmp_v, needed at least $min_v)" ); - return; + return "$class version $cmp_v too low, need version $min_v"; } $cmp_v =~ s/_//; $cmp_v= sprintf( "%.2f", int( $cmp_v * 100 ) / 100 ); my %compat_versions= map { $_ => 1 } $Class->_test_compat(); - if ( not defined $cmp_v or not exists $compat_versions{$cmp_v} ) { + if ( not length($cmp_v) or not exists $compat_versions{$cmp_v} ) { diag( "Could not load correct version of $class for testing " . "(got: $cmp_v, needed any of " . join( ", ", keys %compat_versions ) . ")" ); - return (); + return "$class version $cmp_v not compatible, $Class is version $min_v" } } - return 1; + return ""; } # max iv/uv logic taken from Storable tests @@ -1042,13 +1061,11 @@ } my $suffix= "_v$proto_version"; + # older v2.x and v1.0 should ingore this. + $opts->{protocol_version}= $proto_version; if ( $proto_version == 1 ) { $opts->{use_protocol_v1}= 1; } - else { - # v2 ignores this, but will output v2 by default - $opts->{protocol_version}= $proto_version; - } setup_tests($proto_version); run_roundtrip_tests_internal( $name . $suffix, $opts ); } @@ -1150,6 +1167,11 @@ return $ret; } +our $deep_cmp_name; # set by deep_cmp() +sub _test_deep_cmp { + local $deep_cmp_name= "_test_deep_cmp"; + return _deep_cmp(@_); +} sub _deep_cmp { my ( $x, $y, $seenx, $seeny )= @_; $seenx ||= {}; @@ -1205,7 +1227,20 @@ die "Unknown reftype '", reftype($x) . "'"; } } - else { + else{ + if ( + $deep_cmp_name !~ /v5/ and $deep_cmp_name =~ /float/ + and $x=~/^-?\d+\.\d+\z/ and $y=~/^-?\d+\.\d+\z/ + ) { + if ($deep_cmp_name=~/(-?\d+\.(\d+))/) { + my $maxf= length $1; + my $minf= length $2; + $_= sprintf "%*.*f", $maxf, $minf, $_ + for $x, $y; + } else { + $_= sprintf "%f", $_ for $x, $y; + } + } $cmp= _cmp_str( $x, $y ) and return $cmp; } @@ -1214,6 +1249,7 @@ sub deep_cmp { my ( $v1, $v2, $name )= @_; + local $deep_cmp_name= $name; my $diff= _deep_cmp( $v1, $v2 ); if ($diff) { my ( $reason, $diag )= split /\n/, $diff, 2;