Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Sereal-Encoder CPAN distribution.

Report information
The Basics
Id: 101931
Status: new
Priority: 0/
Queue: Sereal-Encoder

People
Owner: Nobody in particular
Requestors: zefram [...] fysh.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bitwise behaviour not preserved
Date: Wed, 4 Feb 2015 12:59:17 +0000
To: bug-Sereal-Encoder [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
Download (untitled) / with headers
text/plain 1.3k
$ perl -MSereal::Encoder=encode_sereal -MSereal::Decoder=decode_sereal -MTest::More=no_plan -MDevel::Peek -lwe 'sub roundtrip_ok { ok +(decode_sereal(encode_sereal($_[0])) ^ "1") eq ($_[0] ^ "1"); } roundtrip_ok 1; roundtrip_ok "1"; my $a = "1"; my $b = $a+0; my $c = $a+0.5; roundtrip_ok $a' ok 1 ok 2 not ok 3 # Failed test at -e line 1. 1..3 # Looks like you failed 1 test of 3. This is testing whether scalars are treated as numbers or as strings for the purposes of bitwise ops. This is a visible feature of a scalar, which Sereal should probably preserve. Internally the test is actually SvNIOK(). Sereal preserves this status for most scalars, but a scalar that is simultaneously IOK, NOK, and POK comes out POK-only, thus changing its SvNIOK() status. Obviously, this interacts with whatever is done for [rt.cpan.org #101876]. Simple fixes for that cause the bitwise-roundtrip test to fail in more cases. Preserving bitwise status while also preserving string value would require essentially passing at least one NIOK bit alongside a string value, which would require a protocol addition. If the protocol is going to be changed in this area, it might be wise to extend it to full dualvar handling at the same time. If you'd rather not have Sereal preserve bitwise status, this limitation should be documented. -zefram


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.