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

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

Operating System: (no value)
PatchStatus: HasPatch
Severity: low
Type:
Perl Version:
  • 5.16.0
  • 5.16.1
  • 5.16.2
  • 5.16.3
  • 5.16.4
  • 5.17.0
  • 5.17.1
  • 5.17.2
  • 5.17.3
  • 5.17.4
  • 5.17.5
  • 5.17.6
  • 5.17.7
  • 5.17.8
  • 5.17.9
  • 5.17.10
  • 5.17.11
  • 5.17.12
  • 5.18.0
  • 5.18.1
  • 5.19.0
  • 5.19.1
  • 5.19.2
  • 5.19.3
Fixed In: (no value)

Attachments
0001-Adjust-documentation-for-removal-of-splice-warning.patch



Subject: "splice() offset past end of array" warning doesn't always appear
Date: Tue, 23 Apr 2013 13:13:40 -0700
To: perlbug [...] perl.org
From: Karen Etheridge <perl [...] froods.org>
Download (untitled) / with headers
text/plain 707b
According to the splice documentation in perlfunc: splice ARRAY or EXPR,OFFSET If OFFSET is past the end of the array, Perl issues a warning, and splices at the end of the array. Consider: perl -wle'use warnings FATAL => "all"; my @arr = qw(0 .. 10); splice(@arr, 20); print "ar is @arr"' This generates a warning on some versions/architectures and not others. Based on the versions tested, this appears to have regressed between 5.14.3 and 5.16.0. warning: 5.8.9 darwin OSX 10.6.8 5.14.2 darwin OSX 10.6.8 5.14.3 darwin OSX 10.6.8 5.14.3 linux CentOS no warning: 5.16.0 linux ubuntu 5.16.0 darwin OSX 10.6.8 5.16.1 darwin OSX 10.6.8 5.16.3 darwin OSX 10.6.8 5.17.11 darwin OSX 10.6.8
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 861b
On Tue Apr 23 13:14:02 2013, perl@froods.org wrote: Show quoted text
> > According to the splice documentation in perlfunc: > > splice ARRAY or EXPR,OFFSET > > If OFFSET is past the end of the array, Perl issues a warning, and > splices at the end of the array. > > Consider: > perl -wle'use warnings FATAL => "all"; my @arr = qw(0 .. 10); > splice(@arr, 20); print "ar is @arr"' > > This generates a warning on some versions/architectures and not > others. > Based on the versions tested, this appears to have regressed between > 5.14.3 > and 5.16.0. > > > warning: > 5.8.9 darwin OSX 10.6.8 > 5.14.2 darwin OSX 10.6.8 > 5.14.3 darwin OSX 10.6.8 > 5.14.3 linux CentOS > > no warning: > 5.16.0 linux ubuntu > 5.16.0 darwin OSX 10.6.8 > 5.16.1 darwin OSX 10.6.8 > 5.16.3 darwin OSX 10.6.8 > 5.17.11 darwin OSX 10.6.8 >
Confirmed to occur in blead as well.
CC: perl5 porters <perl5-porters [...] perl.org>
Subject: Re: [perl #117729] "splice() offset past end of array" warning doesn't always appear
Date: Wed, 24 Apr 2013 00:51:18 -0400
To: Tim Bunce via RT <perlbug-followup [...] perl.org>
From: Eric Brine <ikegami [...] adaelis.com>
Download (untitled) / with headers
text/plain 1.5k
It's not a regression; it's an intentional change.

C<< splice(@a, $n) >> is commonly used to truncate an array if it's too large, so C<< splice(@a, $n) >> (with no further args) does not warn even if @a<$n.

See
https://rt.perl.org/rt3/Public/Bug/Display.html?id=78462

So, this is merely a documentation bug for which I'll submit a patch tomorrow.

- Eric



On Tue, Apr 23, 2013 at 8:34 PM, James E Keenan via RT <perlbug-followup@perl.org> wrote:
Show quoted text
On Tue Apr 23 13:14:02 2013, perl@froods.org wrote:
>
> According to the splice documentation in perlfunc:
>
>    splice ARRAY or EXPR,OFFSET
>
>    If OFFSET is past the end of the array, Perl issues a warning, and
>    splices at the end of the array.
>
> Consider:
>     perl -wle'use warnings FATAL => "all"; my @arr = qw(0 .. 10);
> splice(@arr, 20); print "ar is @arr"'
>
> This generates a warning on some versions/architectures and not
> others.
> Based on the versions tested, this appears to have regressed between
> 5.14.3
> and 5.16.0.
>
>
> warning:
> 5.8.9 darwin OSX 10.6.8
> 5.14.2 darwin OSX 10.6.8
> 5.14.3 darwin OSX 10.6.8
> 5.14.3 linux CentOS
>
> no warning:
> 5.16.0 linux ubuntu
> 5.16.0 darwin OSX 10.6.8
> 5.16.1 darwin OSX 10.6.8
> 5.16.3 darwin OSX 10.6.8
> 5.17.11 darwin OSX 10.6.8
>


Confirmed to occur in blead as well.

---
via perlbug:  queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=117729

Subject: Re: [perl #117729] "splice() offset past end of array" warning doesn't always appear
Date: Wed, 24 Apr 2013 07:47:28 -0700
To: Eric Brine via RT <perlbug-followup [...] perl.org>
From: Karen Etheridge <perl [...] froods.org>
Download (untitled) / with headers
text/plain 632b
On Tue, Apr 23, 2013 at 09:52:07PM -0700, Eric Brine via RT wrote: Show quoted text
> It's not a regression; it's an intentional change. > > C<< splice(@a, $n) >> is commonly used to truncate an array if it's too > large, so C<< splice(@a, $n) >> (with no further args) does not warn even > if @a<$n.
This is quite reasonable (and indeed, this is the exact usecase where I discovered that there was a warning on my not-quite-as-current production system). :) Show quoted text
> So, this is merely a documentation bug for which I'll submit a patch > tomorrow.
Thanks! (Was there also a perldelta entry for this? it's not too late to put one in perldelta5160.)
CC: Eric Brine via RT <perlbug-followup [...] perl.org>
Subject: Re: [perl #117729] "splice() offset past end of array" warning doesn't always appear
Date: Mon, 3 Jun 2013 00:43:28 -0400
To: Karen Etheridge <perl [...] froods.org>
From: Eric Brine <ikegami [...] adaelis.com>

Message body is not shown because sender requested not to inline it.

Download (untitled) / with headers
text/plain 508b
On Wed, Apr 24, 2013 at 10:47 AM, Karen Etheridge <perl@froods.org> wrote:
Show quoted text
On Tue, Apr 23, 2013 at 09:52:07PM -0700, Eric Brine via RT wrote:
Show quoted text
> So, this is merely a documentation bug for which I'll submit a patch
> tomorrow.
Show quoted text

Thanks!  (Was there also a perldelta entry for this?  it's not too late to 
Show quoted text
put one in perldelta5160.)

Patched attached. Ok, it's not "tomorrow", but I figured I'd wait til 5.18 was out.

It actually is too late to add to perldelta5160, but it was actually mentioned.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 572b
On Sun Jun 02 21:44:25 2013, ikegami@adaelis.com wrote: Show quoted text
> On Wed, Apr 24, 2013 at 10:47 AM, Karen Etheridge <perl@froods.org> wrote: >
> > On Tue, Apr 23, 2013 at 09:52:07PM -0700, Eric Brine via RT wrote: > > > > So, this is merely a documentation bug for which I'll submit a patch
> > > tomorrow.
> >
>
> > Thanks! (Was there also a perldelta entry for this? it's not too
late to Show quoted text
> > put one in perldelta5160.)
> >
> > Patched attached. Ok, it's not "tomorrow", but I figured I'd wait til 5.18 > was out.
Thank you. Applied as 8e602cc. -- Father Chrysostomos


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