develooper Front page | perl.perl5.porters | Postings from May 2019

[perl #134150] use re 'debug' ignored for uniprop embedded regexps

From:
Tony Cook
Date:
May 30, 2019 04:27
Subject:
[perl #134150] use re 'debug' ignored for uniprop embedded regexps
Message ID:
rt-4.0.24-20917-1559190421-1107.134150-75-0@perl.org
# New Ticket Created by  Tony Cook 
# Please include the string:  [perl #134150]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134150 >


This is a bug report for perl from tony@develop-help.com,
generated with the help of perlbug 1.41 running under perl 5.31.1.


-----------------------------------------------------------------
[Please describe your issue here]

use re 'debug' doesn't enable debug output for regexps embedded in
unicode properties, for example:

$ ./perl -Ilib -Mre=debug -e 'qr!\p{numeric_value=/\A[0-5]\z/}!'
Compiling REx "\p{numeric_value=/\A[0-5]\z/}"
The Unicode property wildcards feature is experimental at -e line 1.
~ tying lastbr ANYOF[0-5\xB2\xB3\xB9][0660-0665 06F0-06F5 07C0-07C5 0966-096B 09E6-09EB 0A66-0A6B 0AE6-0AEB 0B66-0B6B 0BE6-0BEB 0C66-0C6B 0C78-0C7E 0CE6-0CEB 0D66-0D6B 0DE6-0DEB 0E50-0E55 0ED0-0ED5 0F20-0F25 1040-1045 1090-1095 1369-136D 17E0-17E5 17F0-17F5 1810-1815 1946-194B 19D0-19D5 19DA...] (1) to ender END (11) offset 10
Final program:
   1: ANYOF[0-5\xB2\xB3\xB9][0660-0665 06F0-06F5 07C0-07C5 0966-096B 09E6-09EB 0A66-0A6B 0AE6-0AEB 0B66-0B6B 0BE6-0BEB 0C66-0C6B 0C78-0C7E 0CE6-0CEB 0D66-0D6B 0DE6-0DEB 0E50-0E55 0ED0-0ED5 0F20-0F25 1040-1045 1090-1095 1369-136D 17E0-17E5 17F0-17F5 1810-1815 1946-194B 19D0-19D5 19DA...] (11)
  11: END (0)
stclass ANYOF[0-5\xB2\xB3\xB9][0660-0665 06F0-06F5 07C0-07C5 0966-096B 09E6-09EB 0A66-0A6B 0AE6-0AEB 0B66-0B6B 0BE6-0BEB 0C66-0C6B 0C78-0C7E 0CE6-0CEB 0D66-0D6B 0DE6-0DEB 0E50-0E55 0ED0-0ED5 0F20-0F25 1040-1045 1090-1095 1369-136D 17E0-17E5 17F0-17F5 1810-1815 1946-194B 19D0-19D5 19DA...] minlen 1 
Freeing REx: "\p{numeric_value=/\A[0-5]\z/}"

But -Dr does produce such output:

$ ./perl -Ilib -Dr -e 'qr!\p{numeric_value=/\A[0-5]\z/}!' 2>&1 | head -15
Compiling REx "\p{numeric_value=/\A[0-5]\z/}"
The Unicode property wildcards feature is experimental at -e line 1.
Compiling REx "(?iaa:\A[0-5]\z)"
~ tying lastbr SBOL /\A/ (1) to ender END (13) offset 12
rarest char 
 at 0
Final program:
   1: SBOL /\A/ (2)
   2: ANYOF[0-5] (12)
  12: EOS (13)
  13: END (0)
anchored ""$ at 1..1 stclass ANYOF[0-5] anchored(SBOL) minlen 1 
Matching REx "(?iaa:\A[0-5]\z)" against "-1/2"
   0 <> <-1/2>               |   0| 1:SBOL /\A/(2)
   0 <> <-1/2>               |   0| 2:ANYOF[0-5](12)

which doesn't match the documentation.

It also means that a user with only a non-DEBUGGING perl (as is
typical) can't use C<use re 'debug';> to trace compilation and
execution of the embedded regular expression.

I mentioned this to Karl who suggested a ticket for further
discussion.

Patch with fix attached.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.31.1:

Configured by tony at Thu May 30 09:51:48 AEST 2019.

Summary of my perl5 (revision 5 version 31 subversion 1) configuration:
  Derived from: fd0b39e2c8e08d180653e64e96276216d2b606ac
  Platform:
    osname=linux
    osvers=4.9.0-8-amd64
    archname=x86_64-linux
    uname='linux mars 4.9.0-8-amd64 #1 smp debian 4.9.130-2 (2018-10-27) x86_64 gnulinux '
    config_args='-des -Dusedevel -DDEBUGGING -Doptimize=-O0 -g'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O0 -g'
    cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='6.3.0 20170516'
    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='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/6/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.24.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.24'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O0 -g -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    uncommitted-changes

---
@INC for perl 5.31.1:
    lib
    /usr/local/lib/perl5/site_perl/5.31.1/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.31.1
    /usr/local/lib/perl5/5.31.1/x86_64-linux
    /usr/local/lib/perl5/5.31.1

---
Environment for perl 5.31.1:
    HOME=/home/tony
    LANG=en_AU.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/tony/perl5/perlbrew/bin:/home/tony/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
    PERLBREW_BASHRC_VERSION=0.43
    PERLBREW_HOME=/home/tony/.perlbrew
    PERLBREW_MANPATH=
    PERLBREW_PATH=/home/tony/perl5/perlbrew/bin
    PERLBREW_ROOT=/home/tony/perl5/perlbrew
    PERLBREW_VERSION=0.67
    PERL_BADLANG (unset)
    SHELL=/bin/bash



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