Bug#732715: liblist-moreutils-perl: "Attempt to free unreferenced scalar" in some use cases of List::MoreUtils::part
Christoph Biedl
debian.axhn at manchmal.in-ulm.de
Fri Dec 20 16:00:14 UTC 2013
Package: liblist-moreutils-perl
Version: 0.33-1+b2
Severity: normal
Dear Maintainer,
This is quite weird. If the code used in `part`
* is built using given..when
* does a return after a match on the first value of the list
the code will result in the dreaded "Attempt to free unreferenced scalar"
message. Reproducer (tested on amd64 and i386):
{{{
#!/usr/bin/perl
use 5.010;
use List::MoreUtils;
my @files = (
'foo',
'bar',
);
my @groups = List::MoreUtils::part (
sub {
given ($_) {
when ('foo') {
return 0; # this return is evil
}
default {
return 1; # this one does no harm
}
}
},
@files,
);
}}}
Output:
{{{
given is experimental at reproducer line 13.
when is experimental at reproducer line 14.
Attempt to free unreferenced scalar: SV 0x1c1ae98, Perl interpreter: 0x1c18010.
}}}
There is more than one workaround: Omit the "return" keyword.
Rewriting the code to "return" outside the given..when block does
the trick, too. The pure Perl implementation does the right thing,
too.
As said before, the message is triggered by the way the code block
is left for the first list element of the list processed, in other
words, this one
{{{
when ('bar') {
1;
}
default {
return 0;
}
}}}
is affected, too.
So I think somebody should take a look into that. I'm concerned the
observation is just a symptom of a bigger problem like data
corruption.
-- System Information:
Debian Release: jessie/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.10.24 (SMP w/4 CPU cores; PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages liblist-moreutils-perl depends on:
ii libc6 2.17-97
ii perl 5.18.1-5
ii perl-base [perlapi-5.18.1] 5.18.1-5
liblist-moreutils-perl recommends no packages.
liblist-moreutils-perl suggests no packages.
-- no debconf information
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20131220/38b5b0ca/attachment-0001.sig>
More information about the pkg-perl-maintainers
mailing list