develooper Front page | perl.perl5.porters | Postings from May 2022

perl v5.36.0 and JSON::PP and Cpanel::JSON::XS

From:
Ricardo Signes
Date:
May 20, 2022 18:47
Subject:
perl v5.36.0 and JSON::PP and Cpanel::JSON::XS
Message ID:
b48d3be6-fb96-47f6-aaa9-efc997624210@dogfood.fastmail.com
Porters,

There may be some problems with v5.36.0-RC1 that I don't know about.  Please give it a look.  Consider especially looking at the release notes and other documentation changes, which are easy to overlook, because they aren't easily tested.  But that's not why I'm writing this email.

We have just one blocker on the books, and it won't require we change anything in perl5.git, but I wanted to give some details to the group.

Perl v5.36.0 will ship with JSON::PP v4.07.  CPAN currently has JSON::PP v4.08.  In that new CPAN release, boolean-type scalars are serialized as booleans.  Here's a demonstration:

# With JSON::PP v4.07 on v5.36.0-RC0
dinah:~$ perl -MJSON::PP -E 'say encode_json({ true => 1 == 1 }) '
{"true":1}

# With JSON::PP v4.08 on v5.36.0-RC0
dinah:~$ perl -MJSON::PP -E 'say encode_json({ true => 1 == 1 }) '
{"true":true}

Now, note that on perl v5.34.0, these would both serialize the value to 1.  That's because v5.34 doesn't have stable bool types.  This change in behavior got onto my radar because of a separate bug in the tests of Cpanel::JSON::XS.  To prepare for this change, it expected the "serialize to true" value whenever perl was new enough, without considering the version of JSON::PP.  That led to problems when installing Cpanel::JSON::XS without first upgrading JSON::PP on a new late-v5.35 perl.

The current situation is bad because Cpanel::JSON::XS, a common dependency, can't be installed out of the box on v5.36.0-RC1.  We could fix it by shipping JSON::PP v4.08 with v5.36, but that would create a new and largely-untested behavior for JSON serialization right at the last minute.  We (the PSC) do not want to do that.

Instead, we have asked CHARSBAR to revert this change in boolean serialization.  It's probably a good change, but the current timing of it makes it something of a time bomb that we're concerned will make the upgrade to v5.36.0 seem dangerous instead of exciting. 🙂  He said he would do so.  The next step will be to ask RURBAN to adjust his tests to follow JSON::PP v4.09 and, probably, to treat v4.08 as a fluke.

Once new releases of both libraries are on the CPAN, there won't be any known blockers, except for those that surface in the interim.

-- 
rjbs


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About