Skip Menu |
Report information
Id: 123410
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: rjbs <rjbs [at] cpan.org>
Cc:
AdminCc:

Operating System: darwin
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.21.5
Fixed In: 5.22.0



CC: rjbs [...] cpan.org
Subject: bizarre behavior with sort and CORE::fake
From: rjbs [...] cpan.org
To: perlbug [...] perl.org
Date: Thu, 11 Dec 2014 11:54:46 -0500 (EST)
Download (untitled) / with headers
text/plain 4.2k
This is a bug report for perl from rjbs@cpan.org, generated with the help of perlbug 1.40 running under perl 5.21.5. ----------------------------------------------------------------- [Please describe your issue here] ~$ perl -MO=Deparse -E'sort CORE::abc_def("*")' use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; sort CORE::a '*'; -e syntax OK ~$ perl -MO=Deparse -E'sort CORE::abc_def_ghi("*")' use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; sort CORE::abc_d '*'; -e syntax OK Woah. 11:51 <ilmari> it's chopping length("CORE::") off the wrong end? 11:51 <rjbs> ilmari: !! This isn't just Deparse. ~$ perl -E'use Data::Dumper; warn Dumper [sort CORE::abc_def("*")]' Undefined sort subroutine "CORE::a" called at -e line 1. ~$ perl -E'use Data::Dumper; warn Dumper [sort CORE::abc_def_ghi("*")]' Undefined sort subroutine "CORE::abc_d" called at -e line 1. Bug appears in v5.20, not in v5.18. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.21.5: Configured by rjbs at Mon Oct 20 13:54:04 EDT 2014. Summary of my perl5 (revision 5 version 21 subversion 5) configuration: Platform: osname=darwin, osvers=14.0.0, archname=darwin-2level uname='darwin walrus.local 14.0.0 darwin kernel version 14.0.0: fri sep 19 00:26:44 pdt 2014; root:xnu-2782.1.97~2release_x86_64 x86_64 ' config_args='-Dprefix=/Users/rjbs/.plenv/versions/21.5 -de -Dusedevel -A'eval:scriptdir=/Users/rjbs/.plenv/versions/21.5/bin'' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include', optimize='-O3', cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib' libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /opt/local/lib libs=-lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector' --- @INC for perl 5.21.5: /Users/rjbs/.plenv/versions/21.5/lib/perl5/site_perl/5.21.5/darwin-2level /Users/rjbs/.plenv/versions/21.5/lib/perl5/site_perl/5.21.5 /Users/rjbs/.plenv/versions/21.5/lib/perl5/5.21.5/darwin-2level /Users/rjbs/.plenv/versions/21.5/lib/perl5/5.21.5 . --- Environment for perl 5.21.5: DYLD_LIBRARY_PATH (unset) HOME=/Users/rjbs LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/rjbs/.plenv/versions/21.5/bin:/Users/rjbs/.plenv/libexec:/Users/rjbs/.plenv/plugins/perl-build/bin:/Users/rjbs/bin:/Users/rjbs/.rbenv/shims:/Users/rjbs/.rbenv/bin:/Users/rjbs/.plenv/shims:/Users/rjbs/.plenv/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/rjbs/code/hla PERL_AUTOINSTALL=--skipdeps PERL_BADLANG (unset) PERL_MAILERS=sendmail:/Users/rjbs/bin/sendmail SHELL=/opt/local/bin/zsh
Subject: Re: [perl #123410] bizarre behavior with sort and CORE::fake
From: "Matthew Horsfall (alh)" <wolfsage [...] gmail.com>
To: Perl5 Porters <perl5-porters [...] perl.org>
CC: bugs-bitbucket [...] rt.perl.org
Date: Thu, 11 Dec 2014 12:00:01 -0500
Download (untitled) / with headers
text/plain 1.3k
On Thu, Dec 11, 2014 at 11:55 AM, Ricardo SIGNES <perlbug-followup@perl.org> wrote: Show quoted text
> ~$ perl -MO=Deparse -E'sort CORE::abc_def("*")' > use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; > sort CORE::a '*'; > -e syntax OK > > ~$ perl -MO=Deparse -E'sort CORE::abc_def_ghi("*")' > use feature 'current_sub', 'evalbytes', 'fc', 'say', 'state', 'switch', 'unicode_strings', 'unicode_eval'; > sort CORE::abc_d '*'; > -e syntax OK
Looks like this broke between 5.19.0 and 5.19.1: /home/mhorsfall/dpppperls/default/perl-5.19.0/bin/perl5.19.0 -MO=Deparse '-E[sort CORE::abc_def("*")]' 2>&1 -e syntax OK [(sort CORE::abc_def '*')]; /home/mhorsfall/dpppperls/default/perl-5.19.1/bin/perl5.19.1 -MO=Deparse '-E[sort CORE::abc_def("*")]' 2>&1 -e syntax OK [(sort CORE::a '*')]; /home/mhorsfall/dpppperls/default/perl-5.19.0/bin/perl5.19.0 '-Euse File::Glob bsd_glob; use Data::Dumper; warn Dumper [sort CORE::bsd_glob("*")]' 2>&1 Undefined sort subroutine "CORE::bsd_glob" called at -e line 1. child exited with value 255 /home/mhorsfall/dpppperls/default/perl-5.19.1/bin/perl5.19.1 '-Euse File::Glob bsd_glob; use Data::Dumper; warn Dumper [sort CORE::bsd_glob("*")]' 2>&1 Undefined sort subroutine "CORE::bs" called at -e line 1. child exited with value 255 -- Matthew Horsfall (alh)
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
To: "Matthew Horsfall (alh)" <wolfsage [...] gmail.com>
Date: Thu, 11 Dec 2014 13:44:37 -0500
Subject: Re: [perl #123410] bizarre behavior with sort and CORE::fake
CC: Perl5 Porters <perl5-porters [...] perl.org>, bugs-bitbucket [...] rt.perl.org
Download (untitled) / with headers
text/plain 471b
* "Matthew Horsfall (alh)" <wolfsage@gmail.com> [2014-12-11T12:00:01] Show quoted text
> Looks like this broke between 5.19.0 and 5.19.1:
Unsurprisingly, it bisects to 01b5ef509f2ebf466fd7de2c1e7406717bb14332 commit 01b5ef509f2ebf466fd7de2c1e7406717bb14332 Author: Father Chrysostomos <sprout@cpan.org> Date: Fri Jun 7 20:16:23 2013 -0700 [perl #24482] Fix sort and require to treat CORE:: as keyword Looks like the code assumes that CORE::... is never bogus? -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.3k
On Thu Dec 11 10:45:12 2014, perl.p5p@rjbs.manxome.org wrote: Show quoted text
> * "Matthew Horsfall (alh)" <wolfsage@gmail.com> [2014-12-11T12:00:01]
> > Looks like this broke between 5.19.0 and 5.19.1:
> > Unsurprisingly, it bisects to 01b5ef509f2ebf466fd7de2c1e7406717bb14332 > > commit 01b5ef509f2ebf466fd7de2c1e7406717bb14332 > Author: Father Chrysostomos <sprout@cpan.org> > Date: Fri Jun 7 20:16:23 2013 -0700 > > [perl #24482] Fix sort and require to treat CORE:: as keyword > > Looks like the code assumes that CORE::... is never bogus?
It adjusts the length by subtracting 6 (length("CORE::")) but does not set it back if it does not find a keyword. $ ./perl -Ilib -le 'sub C { $b <=> $a } print for sort CORE::f 1..10' 10 9 8 7 6 5 4 3 2 1 How do we want this to behave? Normally require and sort treat a word as a bareword (and not a sub call) unless it is a keyword. It’s just that before 01b5ef509f CORE::lc was not treated as a keyword. If we have CORE::elsewhat should we revert to the previous behaviour of treating it as a bareword (a sub name)? Or should we explicitly forbid it the way we do with CORE::elsewhat elsewhere? Either way it’s going to croak, and the former is easier. (Also, I have my doubts as to whether croaking for CORE::thing in general is a wise decision, especially if core keywords are just special subroutines.) -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
On Thu Dec 11 17:55:48 2014, sprout wrote: Show quoted text
> On Thu Dec 11 10:45:12 2014, perl.p5p@rjbs.manxome.org wrote:
> > * "Matthew Horsfall (alh)" <wolfsage@gmail.com> [2014-12-11T12:00:01]
> > > Looks like this broke between 5.19.0 and 5.19.1:
> > > > Unsurprisingly, it bisects to > > 01b5ef509f2ebf466fd7de2c1e7406717bb14332 > > > > commit 01b5ef509f2ebf466fd7de2c1e7406717bb14332 > > Author: Father Chrysostomos <sprout@cpan.org> > > Date: Fri Jun 7 20:16:23 2013 -0700 > > > > [perl #24482] Fix sort and require to treat CORE:: as keyword > > > > Looks like the code assumes that CORE::... is never bogus?
> > It adjusts the length by subtracting 6 (length("CORE::")) but does not > set it back if it does not find a keyword. > > $ ./perl -Ilib -le 'sub C { $b <=> $a } print for sort CORE::f 1..10' > 10 > 9 > 8 > 7 > 6 > 5 > 4 > 3 > 2 > 1 > > How do we want this to behave? Normally require and sort treat a word > as a bareword (and not a sub call) unless it is a keyword. It’s just > that before 01b5ef509f CORE::lc was not treated as a keyword. > > If we have CORE::elsewhat should we revert to the previous behaviour > of treating it as a bareword (a sub name)? Or should we explicitly > forbid it the way we do with CORE::elsewhat elsewhere? > > Either way it’s going to croak, and the former is easier. (Also, I > have my doubts as to whether croaking for CORE::thing in general is a > wise decision, especially if core keywords are just special > subroutines.)
I went with the former in 487e470dbd. -- Father Chrysostomos
Date: Fri, 12 Dec 2014 07:21:09 -0500
From: Ricardo Signes <perl.p5p [...] rjbs.manxome.org>
To: Father Chrysostomos via RT <perlbug-followup [...] perl.org>
CC: ;, perl5-porters [...] perl.org
Subject: Re: [perl #123410] bizarre behavior with sort and CORE::fake
Download (untitled) / with headers
text/plain 133b
* Father Chrysostomos via RT <perlbug-followup@perl.org> [2014-12-12T01:29:13] Show quoted text
> I went with the former in 487e470dbd.
+1 -- rjbs
Download signature.asc
application/pgp-signature 473b

Message body not shown because it is not plain text.

Subject: Your ticket against Perl 5 has been resolved
Download (untitled) / with headers
text/plain 263b
Thanks for submitting this ticket The issue should be resolved with the release today of Perl v5.22, available at http://www.perl.org/get.html If you find that the problem persists, feel free to reopen this ticket -- Karl Williamson for the Perl 5 porters team


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org