Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 114449
Status: open
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

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



Subject: segfault in List::Util::uniq when combined with sort
Download (untitled) / with headers
text/plain 1.1k
`sort uniq @list` has issues... test script: use strict; use warnings; use List::Util 'uniq'; my @list = qw(1 2 a b 4 9 c a 2 4 1); print "1 the sorted uniqed list is ", join(', ', sort(uniq(@list))), "\n"; print "2 the sorted uniqed list is ", join(', ', sort uniq @list), "\n"; on one machine (perl 5.14.2 x86_64-linux-gnu-thread-multi ubuntu), this produces: 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c Segmentation fault on another machine (perl 5.25.0, darwin-2level OSX 10.10.5) it produces: 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c Argument "b" isn't numeric in sort at list.pl line 7. Argument "a" isn't numeric in sort at list.pl line 7. Argument "a" isn't numeric in sort at list.pl line 7. Argument "c" isn't numeric in sort at list.pl line 7. 2 the sorted uniqed list is 1, 4, 2, 9, 4, 2, 1, a, b, c, a perl 5.14.4, darwin-2level OSX 10.10.5: 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c Segmentation fault: 11 perl 5.16.3, darwin-2level OSX 10.10.5 (and also 5.18.4, 5.20.3, 5.22.0, 5.22.2): 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c Sort subroutine didn't return single value at list.pl line 7.
Download (untitled) / with headers
text/plain 1.4k
On Tue May 17 18:32:07 2016, ETHER wrote: Show quoted text
> `sort uniq @list` has issues...
Are you trying to use uniq as the sort comparison routine? If not, put a + in front of it. The 5.25.0 output below is correct. Earlier perl versions had trouble with comparison routines that did not return just a single number. Show quoted text
> > test script: > > use strict; > use warnings; > > use List::Util 'uniq'; > my @list = qw(1 2 a b 4 9 c a 2 4 1); > print "1 the sorted uniqed list is ", join(', ', sort(uniq(@list))), > "\n"; > print "2 the sorted uniqed list is ", join(', ', sort uniq @list), > "\n"; > > > on one machine (perl 5.14.2 x86_64-linux-gnu-thread-multi ubuntu), > this produces: > > 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c > Segmentation fault > > > on another machine (perl 5.25.0, darwin-2level OSX 10.10.5) it > produces: > > 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c > Argument "b" isn't numeric in sort at list.pl line 7. > Argument "a" isn't numeric in sort at list.pl line 7. > Argument "a" isn't numeric in sort at list.pl line 7. > Argument "c" isn't numeric in sort at list.pl line 7. > 2 the sorted uniqed list is 1, 4, 2, 9, 4, 2, 1, a, b, c, a > > > perl 5.14.4, darwin-2level OSX 10.10.5: > > 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c > Segmentation fault: 11 > > > perl 5.16.3, darwin-2level OSX 10.10.5 (and also 5.18.4, 5.20.3, > 5.22.0, 5.22.2): > > 1 the sorted uniqed list is 1, 2, 4, 9, a, b, c > Sort subroutine didn't return single value at list.pl line 7.
Download (untitled) / with headers
text/plain 548b
On 2016-05-17 20:35:36, SPROUT wrote: Show quoted text
> On Tue May 17 18:32:07 2016, ETHER wrote:
> > `sort uniq @list` has issues...
> > Are you trying to use uniq as the sort comparison routine? If not, > put a + in front of it. > > The 5.25.0 output below is correct. Earlier perl versions had trouble > with comparison routines that did not return just a single number.
I should note that this is different behaviour from List::MoreUtils::uniq -- which is how I encountered this issue, when upgrading List::Util and List::AllUtils in my employer's system.


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.