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

[perl #134112] 5.30 regression in Unicode properties defined withsplice

Thread Previous
From:
Petr Pisar
Date:
May 16, 2019 16:14
Subject:
[perl #134112] 5.30 regression in Unicode properties defined withsplice
Message ID:
rt-4.0.24-21672-1558023261-396.134112-75-0@perl.org
# New Ticket Created by  Petr Pisar 
# Please include the string:  [perl #134112]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=134112 >



This is a bug report for perl from ppisar@redhat.com,
generated with the help of perlbug 1.41 running under perl 5.30.0.


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

I noticed Net-IDN-Encode tests fail with Perl 5.30-RC1
<https://rt.cpan.org/Ticket/Display.html?id=129588>. According to CPAN testers
the failure emerged with 5.29.8. (Though the exact way of failing changed
then.) When debugging it I reduced it to the point where I believe it is a bug
in the interpreter.

This program:

#!/usr/bin/perl
package Foo;

sub make {
    my @lines;
    while( my($c) = splice(@_,0,1) ) {
	warn "HIT";
	push @lines, sprintf("%04X", $c);
    }
    return join "\n", @lines;
}

my @characters = ( 0x0061 );
sub IsProperty { make(@characters); };

if ('a' =~ /\p{IsProperty}/) {
    print "ok\n";
} else {
    print "not ok\n";
}
__END__

correctly recognizes 'a' character as \x0061 code point on Perl 5.28.2 because
the while-loop iterates over @characters list:

$ perl /tmp/test
HIT at /tmp/test line 7.
ok

However, this not true on Perl 5.30:

$ perl /tmp/test
not ok

Calling make(@characters) directly works as expected. Replacing make argument
with a literal list (make(0x0061)) works. Replacing the while-splice with
a for(@_) also works. Thus I conclude there is some strange interaction
between user-defined unicode properties and splice.

-- Petr


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

Configured by petr at Thu May 16 17:35:41 CEST 2019.

Summary of my perl5 (revision 5 version 30 subversion 0) configuration:
  Commit id: 3271cf246fc5e8e632a91eaeadd71a58c7eaebb8
  Platform:
    osname=linux
    osvers=5.0.14-200.fc29.x86_64
    archname=x86_64-linux-thread-multi
    uname='linux dhcp-0-146.brq.redhat.com 5.0.14-200.fc29.x86_64 #1 smp thu may 9 10:46:15 utc 2019 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Dusedevel -Dusethreads -Duseithreads -Dldflags=-lm -lpthread -Accflags=-I/usr/src/kernels/5.0.14-200.fc29.x86_64/arch/x86/include'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -I/usr/src/kernels/5.0.14-200.fc29.x86_64/arch/x86/include -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -I/usr/src/kernels/5.0.14-200.fc29.x86_64/arch/x86/include -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='8.3.1 20190223 (Red Hat 8.3.1-2)'
    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 ='-lm -lpthread -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.28.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.28'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


---
@INC for perl 5.30.0:
    lib
    /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.30.0
    /usr/local/lib/perl5/5.30.0/x86_64-linux-thread-multi
    /usr/local/lib/perl5/5.30.0

---
Environment for perl 5.30.0:
    HOME=/home/petr
    LANG=cs_CZ.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/petr/bin:/usr/share/Modules/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
    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