develooper Front page | perl.perl5.porters | Postings from August 2017

[perl #131930] s [foo] \n [bar] confuses line numbers

Thread Previous
From:
Abigail
Date:
August 19, 2017 21:40
Subject:
[perl #131930] s [foo] \n [bar] confuses line numbers
Message ID:
rt-4.0.24-12602-1503178826-907.131930-75-0@perl.org
# New Ticket Created by  Abigail 
# Please include the string:  [perl #131930]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=131930 >



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


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About