Skip to content

B::perlstring returns a double escaped symbol for utf8-on "\e" and breaks Sub::Quote (via pv_uni_display) #17526

Closed
@demerphq

Description

@demerphq

In blead:

$ ./perl -Ilib -MB -E'say "perl version $]"; my $s= "\e"; utf8::upgrade($s); say B::perlstring($s)'
perl version 5.031009
"\e"

In perl 5.18:

$ perl -MB -E'say "perl version $]"; my $s= "\e"; utf8::upgrade($s); say B::perlstring($s)'
perl version 5.018004
"\x{1b}"

This is almost certainly due to daf6caf

This came up while investigating #17245 ([Perl/perl5] BBC: MaxMind-DB-Writer-0.300003 fails since perl 5.31.2)

Note that the fact the escape changed (At a low level) from "\x{1b}" to "\e" would NOT be a problem if it werent that the backslash has been escaped itself, the new output is "\e" which does not round trip.

This also suggests B::perlstring is lacking tests for roundtripping.

This is one for Karl I imagine, but im taking a look too.

$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 31 subversion 9) configuration:
  Derived from: 41eecd54c335a0342b04dbea635695db80579946
  Platform:
    osname=linux
    osvers=4.15.0-72-generic
    archname=x86_64-linux-thread-multi
    uname='linux psykopsis 4.15.0-72-generic #81-ubuntu smp tue nov 26 12:20:02 utc 2019 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dusethreads -Doptimize=-g -d -Dusedevel -Dcc=ccache gcc -Dld=gcc -DDEBUGGING'
    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='gcc'
    ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-g'
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='7.4.0'
    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='gcc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/7/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
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.27.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.27'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -g -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    DEBUGGING
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_IMPLICIT_CONTEXT
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_TRACK_MEMPOOL
    PERL_USE_DEVEL
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
    USE_THREAD_SAFE_LOCALE
  Locally applied patches:
    uncommitted-changes
    4d0e98cf1c8047938279e660371a375efd697eb7
  Built under linux
  Compiled at Feb  2 2020 03:36:27
  %ENV:
    PERLBREW_CONFIGURE_FLAGS="-de -Dcc=ccache\ gcc -Dld=gcc"
    PERLBREW_HOME="/home/yorton/.perlbrew"
    PERLBREW_MANPATH="/home/yorton/perl5/perlbrew/perls/perl-5.18.4/man"
    PERLBREW_PATH="/home/yorton/perl5/perlbrew/bin:/home/yorton/perl5/perlbrew/perls/perl-5.18.4/bin"
    PERLBREW_PERL="perl-5.18.4"
    PERLBREW_ROOT="/home/yorton/perl5/perlbrew"
    PERLBREW_SHELLRC_VERSION="0.88"
    PERLBREW_VERSION="0.88"
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.31.9/x86_64-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.31.9
    /usr/local/lib/perl5/5.31.9/x86_64-linux-thread-multi
    /usr/local/lib/perl5/5.31.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    BBCBlead Breaks CPAN - changes in blead broke a cpan module(s)Bugext/Bissues in the blead-only B distribution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions