Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 540 forks source link

grouping from the result of an regex pattern match is misbehaving. #10906

Closed p5pRT closed 13 years ago

p5pRT commented 13 years ago

Migrated from rt.perl.org#80882 (status was 'rejected')

Searchable as RT80882$

p5pRT commented 13 years ago

From ktomasek@intersil.com

Kevin

p5pRT commented 13 years ago

From ktomasek@intersil.com

Subject​: grouping from the result of an regex pattern match is misbehaving. Message-Id​: \5\.12\.2\_26305\_1292528844@​ausws103 Reply-To​: ktomasek@​ausws103.aus.intersil.com To​: perlbug@​perl.org

This is a bug report for perl from ktomasek@​ausws103.aus.intersil.com\, generated with the help of perlbug 1.39 running under perl 5.12.2.

When grouping from the result of an regex pattern match\, there is a specific pattern which fails to match while another pattern\, which differs by only 2 characters\, will match.

Using the follow command line​:

perl -e 'while(\<>){print $1 if (/\s+\.[A-Z]*\s+\((.*_VCC3I_PadIO).*$/) }' snip.v

the program fails to match and outputs nothing.

while the following command line(s)​:

perl -e 'while(\<>){print $1 if (/\s+\.[A-Z]*\s+\((.*_VCCK_PadIO).*$/) }' snip.v perl -e 'while(\<>){print $1 if (/\s+\.[A-Z]*\s+\((.*_GNDO_PadIO).*$/) }' snip.v

does work and outputs the following​: ADDR0_VCCK_PadIO ADDR0_GNDO_PadIO

the same behaviour is noted when the regex command is included in file and executed as a complete perl script.

the input file called snip.v looks like this​:

  .O (ADDR0_O_PadOut)\,   .GNDI (ADDR0_GNDI_PadIO)\,   .GNDK (ADDR0_GNDK_PadIO)\,   .GNDO (ADDR0_GNDO_PadIO)\,   .IO (ADDR0_IO_PadIO)\,   .VCC3I (ADDR0_VCC3I_PadIO)\,   .VCC3O (ADDR0_VCC3O_PadIO)\,   .VCCK (ADDR0_VCCK_PadIO) );

this behaviour is seen using 5.8.5 which is the system base installation and with 5.12.2 which I freshly downloaded and compiled.

--- Flags​:   category=core   severity=high --- Site configuration information for perl 5.12.2​:

Configured by ktomasek at Wed Dec 15 17​:06​:53 CST 2010.

Summary of my perl5 (revision 5 version 12 subversion 2) configuration​:  
  Platform​:   osname=linux\, osvers=2.6.9-78.0.22.elsmp\, archname=x86_64-linux   uname='linux ausws103 2.6.9-78.0.22.elsmp #1 smp fri apr 24 12​:48​:19 edt 2009 x86_64 x86_64 x86_64 gnulinux '   config_args='-des -Dprefix=/usr/local'   hint=recommended\, useposix=true\, d_sigaction=define   useithreads=undef\, usemultiplicity=undef   useperlio=define\, d_sfio=undef\, uselargefiles=define\, usesocks=undef   use64bitint=define\, use64bitall=define\, uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='cc'\, ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'\,   optimize='-O2'\,   cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'   ccversion=''\, gccversion='3.4.6 20060404 (Red Hat 3.4.6-10)'\, gccosandvers=''   intsize=4\, longsize=8\, ptrsize=8\, doublesize=8\, byteorder=12345678   d_longlong=define\, longlongsize=8\, d_longdbl=define\, longdblsize=16   ivtype='long'\, ivsize=8\, nvtype='double'\, nvsize=8\, Off_t='off_t'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='cc'\, ldflags =' -L/usr/local/lib'   libpth=/usr/local/lib /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64   libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc   perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc   libc=/lib/libc-2.3.4.so\, so=so\, useshrplib=false\, libperl=libperl.a   gnulibc_version='2.3.4'   Dynamic Linking​:   dlsrc=dl_dlopen.xs\, dlext=so\, d_dlsymun=undef\, ccdlflags='-Wl\,-E'   cccdlflags='-fPIC'\, lddlflags='-shared -O2 -L/usr/local/lib'

Locally applied patches​:  

--- @​INC for perl 5.12.2​:   /users/ktomasek/local/lib/perl5/site_perl   /usr/local/lib/perl5/site_perl/5.12.2/x86_64-linux   /usr/local/lib/perl5/site_perl/5.12.2   /usr/local/lib/perl5/5.12.2/x86_64-linux   /usr/local/lib/perl5/5.12.2   .

--- Environment for perl 5.12.2​:   HOME=/users/ktomasek   LANG=en_US.UTF-8   LANGUAGE (unset)   LD_LIBRARY_PATH=/tools_d2/xilinx/ise12.1/ISE_DS/common/lib/lin64​:/usr/lib​:/usr/X11R6/lib/X11​:/lib​:/usr/local/lib​:/lib​:/usr/local/lib​:/apps/lib​:/apps/tools/svn/lib​:/apps/tools/tcl/lib​:/apps/tools/tk/lib​:/apps/tools/assura/assura3.1.7_linux/tools_d2/assura/lib​:/tools_d2/cds/ccd9.10.400/tools/lib​:/tools_d2/cds/cnfrml8.1.480/tools/lib​:/cad_d2/lib/d2a/cds/pli_x86_64​:/tools_d2/cds/ius81.005/tools/lib​:/tools_d2/cds/ic5141usr5/tools/lib​:/apps/tools/mmsim/mmsim7.20.109_linux/tools/lib​:/tools_d2/cds/pvs9.10.103/tools/lib​:/tools_d2/synopsys/tmax2009.06-SP2/linux/iddq/lib​:/tools_d2/novas/versil201001/share/PLI/ius_vhpi_latest/LINUX64/boot​:/tools_d2/novas/versil201001/share/PLI/ius_vhpi_latest/LINUX/boot​:/tools_d2/xilinx/ise12.1/ISE_DS/common/lib/lin64​:/tools_d2/xilinx/ise12.1/ISE_DS/common/X11R6/lib/lin64   LOGDIR (unset)   PATH=/opt/openoffice.org3/program​:/tools_d2/xilinx/ise12.1/ISE_DS/ISE/bin/lin64​:/tools_d2/xilinx/ise12.1/ISE_DS/common/bin/lin64​:/tools_d2/novas/versil201001/bin​:/tools_d2/synopsys/tmax2009.06-SP2/bin​:/tools_d2/synplicity/fpga_94/bin​:/tools_d2/ssoft/R3.3.12/bin​:/tools_d2/cds/rc9.10.102/tools/bin​:/tools_d2/cds/rc9.10.102/bin​:/tools_d2/cds/edi9.11.000/tools/bin​:/tools_d2/cds/pvs9.10.103/tools/bin​:/tools_d2/synopsys/C-2009.06-SP3/bin​:/apps/tools/mmsim/mmsim7.20.109_linux/tools/dfII/bin​:/apps/tools/mmsim/mmsim7.20.109_linux/tools/bin​:/isil/local/bin​:/tools_d2/mapleSoft/maple9.5/bin​:/tools_d2/cds/ic5141usr5/tools/dfII/bin​:/tools_d2/cds/ic5141usr5/tools/bin​:/tools_d2/cds/ius81.005/tools/bin​:/apps/tools/hspice/hspice_vZ-2007.03-SP1/hspice/bin​:/tools_d2/cds/ets9.11.000/tools/bin​:/tools_d2/cds/ets9.11.000/bin​:/apps/tools/dc/syn_vC-2009.06/bin​:/tools_d2/cds/cnfrml8.1.480/bin​:/tools_d2/cds/ccd9.10.400/bin​:/users/ktomasek/sandbox/toad/latest/tr/bin​:/users/ktomasek/bin​:/apps/tools/tk/bin​:/apps/tools/svn/bin​:/usr/local/bin​:/usr/bin​:/bin​:/usr/X11R6/bin​:/cad_d2/bin​:/apps/tools/assura/assura3.1.7_linux/tools/assura/bin   PERL5LIB=/users/ktomasek/local/lib/perl5/site_perl   PERL_BADLANG (unset)   SHELL=/bin/tcsh

p5pRT commented 13 years ago

From @tonycoz

On Thu\, Dec 16\, 2010 at 11​:55​:58AM -0800\, Tomasek\, Kevin wrote​:

# New Ticket Created by "Tomasek\, Kevin" # Please include the string​: [perl #80882] # in the subject line of all future correspondence about this issue. # \<URL​: http​://rt.perl.org/rt3/Ticket/Display.html?id=80882 >

Kevin

Presumably you're expecting​:

  .VCC3I (ADDR0_VCC3I_PadIO)\,

to match​:

  /\s+\.[A-Z]*\s+\((.*_VCC3I_PadIO).*$/

but the "VCC3I" part doesn't match the "[A-Z]*" part\, so the match fails.

Your other tests only need to match (and only match) alphabetic prefixes.

So this doesn't seem to be a bug.

Tony

p5pRT commented 13 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 13 years ago

@cpansprout - Status changed from 'open' to 'rejected'