Skip Menu |
Report information
Id: 131930
Status: pending release
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: abigail [at] abigail.be
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.26.0
Fixed In: 5.27.10



From: Abigail <abigail [...] abigail.be>
Subject: s [foo] \n [bar] confuses line numbers
Date: Sat, 19 Aug 2017 23:41:40 +0200
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 4.6k
This is a bug report for perl from abigail@abigail.be, generated with the help of perlbug 1.40 running under perl 5.26.0. ----------------------------------------------------------------- [Please describe your issue here] Consider the following program: #!/opt/perl/bin/perl use 5.010; say "This is line " . __LINE__; s [foo] [bar]; say "This is line " . __LINE__; __END__ This prints, as expected: This is line 5 This is line 8 Now watch what happens if we move the replacement part of s/// to the blank line below it: #!/opt/perl/bin/perl use 5.010; say "This is line " . __LINE__; s [foo] [bar]; say "This is line " . __LINE__; __END__ Now it gets the second line number wrong: This is line 5 This is line 7 This also effects line numbers of errors and warnings. Note that if the replacement part (or the pattern) contain a newline, the line numbes are fine. It's when the pattern and replacement each use matching braces, and there's a newline between the two sets that we get this error. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=medium --- Site configuration information for perl 5.26.0: Configured by abigail at Fri Jun 2 22:37:04 CEST 2017. Summary of my perl5 (revision 5 version 26 subversion 0) configuration: Platform: osname=darwin osvers=10.8.0 archname=darwin-ld-2level uname='darwin alexia 10.8.0 darwin kernel version 10.8.0: tue jun 7 16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386 ' config_args='-des -Dusemorebits -Uversiononly -Dperladmin=abigail@abigail.be -Dcf_email=abigail@abigail.be -Dmydomain=abigail.be -Dcc=gcc -Dprefix=/opt/perl/ -Dusedevel' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=define uselongdouble=define usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='gcc' ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=10.6 -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include -DPERL_USE_SAFE_PUTENV' optimize='-O3' cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=10.6 -fno-strict-aliasing -pipe -fstack-protector -I/opt/local/include' ccversion='' gccversion='4.2.1 (Apple Inc. build 5666) (dot 3)' gccosandvers='' intsize=4 longsize=8 ptrsize=8 doublesize=8 byteorder=12345678 doublekind=3 d_longlong=define longlongsize=8 d_longdbl=define longdblsize=16 longdblkind=3 ivtype='long' ivsize=8 nvtype='long double' nvsize=16 Off_t='off_t' lseeksize=8 alignbytes=16 prototype=define Linker and Libraries: ld='gcc' ldflags =' -mmacosx-version-min=10.6 -fstack-protector -L/opt/local/lib' libpth=/usr/lib /opt/local/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-lpthread -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=' -mmacosx-version-min=10.6 -bundle -undefined dynamic_lookup -L/opt/local/lib -fstack-protector' --- @INC for perl 5.26.0: /Users/abigail/Perl/CPAN/Regexp-Common2/lib /Users/abigail/Perl/CPAN/Test-Regexp/lib /opt/perl/lib/site_perl/5.26.0/darwin-ld-2level /opt/perl/lib/site_perl/5.26.0 /opt/perl/lib/5.26.0/darwin-ld-2level /opt/perl/lib/5.26.0 /opt/perl/lib/site_perl/5.24.0 /opt/perl/lib/site_perl/5.22.0 /opt/perl/lib/site_perl/5.20.0 /opt/perl/lib/site_perl/5.16.3 /opt/perl/lib/site_perl/5.16.2 /opt/perl/lib/site_perl/5.14.4 /opt/perl/lib/site_perl/5.14.3 /opt/perl/lib/site_perl/5.12.5 /opt/perl/lib/site_perl/5.10.1 /opt/perl/lib/site_perl/5.8.9 /opt/perl/lib/site_perl --- Environment for perl 5.26.0: DYLD_LIBRARY_PATH (unset) HOME=/Users/abigail LANG (unset) LANGUAGE (unset) LC_CTYPE=UTF-8 LD_LIBRARY_PATH=/Users/abigail/Lib:/usr/local/lib:/usr/lib:/lib:/usr/X11R6/lib LOGDIR (unset) PATH=/Users/abigail/Bin:/opt/perl/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/games:/opt/git/bin:/Users/abigail/Perl/Photos:/Users/abigail/Perl/Bin:/opt/mysql/bin:/opt/local/bin:/Users/abigail/bin PERL5LIB=/Users/abigail/Perl/CPAN/Regexp-Common2/lib:/Users/abigail/Perl/CPAN/Test-Regexp/lib PERLDIR=/opt/perl PERL_BADLANG (unset) SHELL=/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 989b
On Sat, 19 Aug 2017 14:40:25 -0700, abigail@abigail.be wrote: Show quoted text
> > This is a bug report for perl from abigail@abigail.be, > generated with the help of perlbug 1.40 running under perl 5.26.0. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > Consider the following program: > > #!/opt/perl/bin/perl > > use 5.010; > > say "This is line " . __LINE__; > s [foo] [bar]; > > say "This is line " . __LINE__; > > __END__ > > This prints, as expected: > > This is line 5 > This is line 8 > > > Now watch what happens if we move the replacement part of s/// > to the blank line below it: > > #!/opt/perl/bin/perl > > use 5.010; > > say "This is line " . __LINE__; > s [foo] > [bar]; > say "This is line " . __LINE__; > > __END__ > > Now it gets the second line number wrong: > > This is line 5 > This is line 7
perl5.24.2 is fine, so it was introduced some time between 5.24.0 and 5.26.0. -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 342b
On Sat, 19 Aug 2017 14:40:25 -0700, abigail@abigail.be wrote: It's when the pattern and replacement each Show quoted text
> use matching braces, and there's a newline between the two sets that > we get this error.
The second set does not need to use matching delimiters: $ perl5.27.1 -le 's<foo>' -e' /bar/;' -e' print __LINE__' 2 -- Father Chrysostomos
Subject: Re: [perl #131930] s [foo] \n [bar] confuses line numbers
From: Dave Mitchell <davem [...] iabyn.com>
Date: Mon, 11 Sep 2017 08:05:59 +0100
To: Father Chrysostomos via RT <perlbug-followup [...] perl.org>
CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.1k
On Sat, Aug 19, 2017 at 06:40:24PM -0700, Father Chrysostomos via RT wrote: Show quoted text
> > #!/opt/perl/bin/perl > > > > use 5.010; > > > > say "This is line " . __LINE__; > > s [foo] > > [bar]; > > say "This is line " . __LINE__; > > > > __END__ > > > > Now it gets the second line number wrong: > > > > This is line 5 > > This is line 7
> > perl5.24.2 is fine, so it was introduced some time between 5.24.0 and 5.26.0.
It bisects to this. I'll have a further look sometime. 6432a58ad9a504c2dc834eb0d131a10b4b6c886b is the first bad commit commit 6432a58ad9a504c2dc834eb0d131a10b4b6c886b Author: David Mitchell <davem@iabyn.com> Date: Thu Nov 10 21:38:30 2016 +0000 Eliminate SVrepl_EVAL and SvEVALED() This flag is only used to indicate that the SV holding the text of the replacement part of a s/// has seen at least one /e. Instead, set the IVX field in the SV to a true value. (We already set the NVX field on that SV to indicate a multi-src-line substitution). This is to reduce the number of odd special cases for the SVpbm_VALID flag. -- Justice is when you get what you deserve. Law is when you get what you pay for.
Date: Wed, 7 Mar 2018 09:36:16 +0000
Subject: Re: [perl #131930] s [foo] \n [bar] confuses line numbers
From: Dave Mitchell <davem [...] iabyn.com>
CC: perl5-porters [...] perl.org
To: Father Chrysostomos via RT <perlbug-followup [...] perl.org>
Download (untitled) / with headers
text/plain 1.2k
On Mon, Sep 11, 2017 at 08:05:59AM +0100, Dave Mitchell wrote: Show quoted text
> On Sat, Aug 19, 2017 at 06:40:24PM -0700, Father Chrysostomos via RT wrote:
> > > #!/opt/perl/bin/perl > > > > > > use 5.010; > > > > > > say "This is line " . __LINE__; > > > s [foo] > > > [bar]; > > > say "This is line " . __LINE__; > > > > > > __END__ > > > > > > Now it gets the second line number wrong: > > > > > > This is line 5 > > > This is line 7
> > > > perl5.24.2 is fine, so it was introduced some time between 5.24.0 and 5.26.0.
> > It bisects to this. I'll have a further look sometime. > > 6432a58ad9a504c2dc834eb0d131a10b4b6c886b is the first bad commit > commit 6432a58ad9a504c2dc834eb0d131a10b4b6c886b > Author: David Mitchell <davem@iabyn.com> > Date: Thu Nov 10 21:38:30 2016 +0000 > > Eliminate SVrepl_EVAL and SvEVALED() > > This flag is only used to indicate that the SV holding the text of the > replacement part of a s/// has seen at least one /e. > > Instead, set the IVX field in the SV to a true value. > (We already set the NVX field on that SV to indicate a multi-src-line > substitution). >
Now fixed with v5.27.9-124-g823ba44 -- Red sky at night - gerroff my land! Red sky at morning - gerroff my land! -- old farmers' sayings #14


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