Skip Menu |

This queue is for tickets about the Cache-Memcached-Fast CPAN distribution.

Report information
The Basics
Id: 92678
Status: resolved
Priority: 0/
Queue: Cache-Memcached-Fast

People
Owner: Nobody in particular
Requestors: victor [...] vsespb.ru
Cc:
AdminCc:

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



Subject: behaviour with utf8=0
With utf8=0 Cache::Memcached::Fast should try to utf8::downgrade string before sending it to socket (that's the way perl print/syswrite work (on binary filehandles), MIME::Base64, Digest::SHA, any other perl function/code modules etc). if downgrade fails it should wanr or die. the following test should not fail: === use strict; use warnings; use Cache::Memcached::Fast; my $memd = Cache::Memcached::Fast->new({utf8 => 0, servers => [ '127.0.0.1:11211' ]}); my $s = "\x81"; my $s_u = $s; utf8::upgrade $s_u; die unless $s eq $s_u; $memd->set("XYZ", $s_u); my $s_u2 = $memd->get("XYZ"); die "data corupted" unless $s_u2 eq $s_u; === currently it fails with "data corupted" here is similar code, but print/readline used instead of memcached with binary filehandle. everything works fine. === use strict; use warnings; my $s = "\x81"; my $s_u = $s; utf8::upgrade $s_u; die unless $s eq $s_u; open my $f, ">", "file.tmp"; binmode $f; print $f $s_u; close $f; open $f, "<", "file.tmp"; my ($s_u2) = <$f>; close $f; die "data corupted" unless $s_u2 eq $s_u; ===
On Mon Feb 03 07:57:13 2014, vsespb wrote: Show quoted text
> With utf8=0 Cache::Memcached::Fast should try to utf8::downgrade > string before sending it to socket (that's the way perl print/syswrite > work (on binary filehandles)
I think we should do what original Cache::Memcached does. Do you imply that C::M tries to downgrade (perhaps implicitly in syswrite())?
On Mon Feb 03 18:53:10 2014, KROKI wrote: Show quoted text
> On Mon Feb 03 07:57:13 2014, vsespb wrote:
> > With utf8=0 Cache::Memcached::Fast should try to utf8::downgrade > > string before sending it to socket (that's the way perl > > print/syswrite > > work (on binary filehandles)
> > I think we should do what original Cache::Memcached does. Do you > imply that C::M tries to downgrade (perhaps implicitly in syswrite())?
ok, indeed C::M broken that way too. I reported https://rt.cpan.org/Ticket/Display.html?id=92687 C::M would work correctly if I remove "use bytes" everywhere. It breaks unicode things. (of course I cannot just remove use bytes, it needed for bytes::length , gzip compression, maybe something else. it just should not be global)
On Mon Feb 03 10:58:59 2014, vsespb wrote: Show quoted text
> ok, indeed C::M broken that way too.
I pushed the fix to https://github.com/kroki/Cache-Memcached-Fast (commit https://github.com/kroki/Cache-Memcached-Fast/commit/94d9b95b21f42436581181091c285daf35a8fb). Can you build from there or should I make the release?
I've tested 94d9b95b21f42436581181091c285daf35a8fb everything looks ok! On Mon Feb 03 22:00:03 2014, KROKI wrote: Show quoted text
> On Mon Feb 03 10:58:59 2014, vsespb wrote:
> > ok, indeed C::M broken that way too.
> > I pushed the fix to https://github.com/kroki/Cache-Memcached-Fast > (commit https://github.com/kroki/Cache-Memcached- > Fast/commit/94d9b95b21f42436581181091c285daf35a8fb). Can you build > from there or should I make the release?
Fixed in 0.22.