Cache::Memcached - pos() weirdness

Dave Evans memcached-list-20040309@djce.org.uk
Fri, 21 May 2004 00:23:19 +0100


Brad Fitzpatrick wrote:
> I was hoping your answer was 5.005 or 5.9, since we use both 5.6 and 5.8
> and have never seen that problem.
> 
> Does it happen with a minimal script, or only when running together with
> your application?  Perhaps your application sets some weird $<@#(
> variable which Perl interprets as "make pos suck"?

After some experimentation, it seems the answer is: Taint mode.

This test is against Cache::Memcached 1.0.12, with my "undef.patch"
applied (which makes no difference to the result; it just makes the
output easier to read).

First, without taint mode:

[davide@www Cache-Memcached-1.0.12]$ perl -w -I blib/lib
-MCache::Memcached -le 'print
Cache::Memcached->new({debug=>0,servers=>["127.0.0.1:11211"]})->get("un-root")'
CI::Person=HASH(0x82377b0)

("un-root" is just a key in my cache, of course).

Now with taint mode enabled:

[davide@www Cache-Memcached-1.0.12]$ perl -Tw -I blib/lib
-MCache::Memcached -le 'print
Cache::Memcached->new({debug=>0,servers=>["127.0.0.1:11211"]})->get("un-root")'
Use of uninitialized value in subtraction (-) at
blib/lib/Cache/Memcached.pm line 494.
Use of uninitialized value in substr at blib/lib/Cache/Memcached.pm line
495.
Use of uninitialized value in addition (+) at
blib/lib/Cache/Memcached.pm line 498.
Storable binary image v43.65 more recent than I am (v2.6) at
blib/lib/Storable.pm (autosplit into blib/lib/auto/Storable/thaw.al)
line 363, at blib/lib/Cache/Memcached.pm line 438

However even armed with this clue, I haven't yet been able to reproduce
the problem outside of Memcached.pm (for example, in a perl "-e" script).

-- 
Dave

PGP key: http://rudolf.org.uk/pgpkey