Perl / perl5

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

BBC: 5.39.7 breaks GONZUS/Cache-utLRU-0.002000.tar.gz on DEBUGGING perls #21876

Closed andk closed 3 months ago

andk commented 8 months ago

Description

With v5.39.6-58-gb6f2485657 a test started to fail for GONZUS/Cache-utLRU-0.002000.tar.gz on DEBUGGING perls

Sample fail report: http://www.cpantesters.org/cpan/report/374ab3d2-b8fe-11ee-8ce7-d4c061afec44

Bisect says:

b6f2485657db9591ba249dc917047dbd11b373cf is the first bad commit
commit b6f2485657db9591ba249dc917047dbd11b373cf
Author: David Mitchell <davem@iabyn.com>
Date:   Mon Dec 11 11:36:55 2023 +0000

    use rpp_foo_NN() and rpp_foo_IMM() widely

    Make more use of the recently-added _NN and _IMM_NN variants of common
    functions throughout the pp*.c files. The _NN ones assume anything being
    popped of the stack is non-NULL, so that check can be skipped for each
    SV being popped. The _IMM variants mean that the one item being put on
    the stack is an immortal like &PL_sv_undef, so doesn't need its
    reference count adjusting.

    So these are all just small optimisations.

 pp.c      | 230 +++++++++++++++++++++++++++++++-------------------------------
 pp_ctl.c  | 106 ++++++++++++++---------------
 pp_hot.c  | 143 +++++++++++++++++++-------------------
 pp_sort.c |  12 ++--
 pp_sys.c  |  24 +++----
 5 files changed, 255 insertions(+), 260 deletions(-)

Steps to Reproduce

cpan -i GONZUS/Cache-utLRU-0.002000.tar.gz

Expected behavior

Should compile and test OK

Perl configuration

# perl -V output goes here
Summary of my perl5 (revision 5 version 39 subversion 7) configuration:
  Commit id: 96559478fdc3f2fe9c51cad02ebbae0c950b7b68
  Platform:
    osname=linux
    osvers=5.4.0-169-generic
    archname=x86_64-linux
    uname='linux k93focal 5.4.0-169-generic #187-ubuntu smp thu nov 23 14:52:28 utc 2023 x86_64 x86_64 x86_64 gnulinux '
    config_args='-Dprefix=/home/sand/src/perl/repoperls/installed-perls/host/k93focal/v5.39.7/b254 -Dmyhostname=k93focal -Dinstallusrbinperl=n -Uversiononly -Dusedevel -des -Ui_db -Dlibswanted=cl pthread socket inet nsl gdbm dbm malloc dl ld sun m crypt sec util c cposix posix ucb BSD gdbm_compat -Uuseithreads -Uuselongdouble -DEBUGGING=both'
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  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'
    optimize='-O2 -g'
    cppflags='-fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='9.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='cc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
    libs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.31.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.31'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options:
    DEBUGGING
    HAS_LONG_DOUBLE
    HAS_STRTOLD
    HAS_TIMES
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Built under linux
  Compiled at Jan 20 2024 13:20:44
  %ENV:
    PERL="/tmp/basesmoker-reloperl-macy/bin/perl"
    PERL5LIB="/tmp/loop_over_bdir-3551-l8emhy/Lemonldap-NG-Cli-0.2-0/blib/arch:/tmp/loop_over_bdir-3551-l8emhy/Lemonldap-NG-Cli-0.2-0/blib/lib:/tmp/loop_over_bdir-3551-l8emhy/Linux-InitFS-0.2-0/blib/arch:/tmp/loop_over_bdir-3551-l8emhy/Linux-InitFS-0.2-0/blib/lib:/tmp/loop_over_bdir-3551-l8emhy/Lingua-YaTeA-0.626-0/blib/arch:/tmp/loop_over_bdir-3551-l8emhy/Lingua-YaTeA-0.626-0/blib/lib:/tmp/loop_over_bdir-3551-l8emhy/Debian-Packages-0.03-0/blib/arch:/tmp/loop_over_bdir-3551-l8emhy/Debian-Packages-0.03-0/blib/lib"
    PERL5OPT=""
    PERL5_CPANPLUS_IS_RUNNING="3559"
    PERL5_CPAN_IS_RUNNING="3559"
    PERL_CANARY_STABILITY_NOPROMPT="1"
    PERL_MM_USE_DEFAULT="1"
    PERL_USE_UNSAFE_INC="1"
  @INC:
    /tmp/loop_over_bdir-3551-l8emhy/Lemonldap-NG-Cli-0.2-0/blib/arch
    /tmp/loop_over_bdir-3551-l8emhy/Lemonldap-NG-Cli-0.2-0/blib/lib
    /tmp/loop_over_bdir-3551-l8emhy/Linux-InitFS-0.2-0/blib/arch
    /tmp/loop_over_bdir-3551-l8emhy/Linux-InitFS-0.2-0/blib/lib
    /tmp/loop_over_bdir-3551-l8emhy/Lingua-YaTeA-0.626-0/blib/arch
    /tmp/loop_over_bdir-3551-l8emhy/Lingua-YaTeA-0.626-0/blib/lib
    /tmp/loop_over_bdir-3551-l8emhy/Debian-Packages-0.03-0/blib/arch
    /tmp/loop_over_bdir-3551-l8emhy/Debian-Packages-0.03-0/blib/lib
    /home/sand/src/perl/repoperls/installed-perls/host/k93focal/v5.39.7/b254/lib/site_perl/5.39.7/x86_64-linux
    /home/sand/src/perl/repoperls/installed-perls/host/k93focal/v5.39.7/b254/lib/site_perl/5.39.7
    /home/sand/src/perl/repoperls/installed-perls/host/k93focal/v5.39.7/b254/lib/5.39.7/x86_64-linux
    /home/sand/src/perl/repoperls/installed-perls/host/k93focal/v5.39.7/b254/lib/5.39.7
    .
iabyn commented 8 months ago

On Tue, Jan 23, 2024 at 12:22:35PM -0800, andk wrote:

Description

With v5.39.6-58-gb6f2485657 a test started to fail for GONZUS/Cache-utLRU-0.002000.tar.gz on DEBUGGING perls

Sample fail report: http://www.cpantesters.org/cpan/report/374ab3d2-b8fe-11ee-8ce7-d4c061afec44

Bisect says:


b6f2485657db9591ba249dc917047dbd11b373cf is the first bad commit
commit b6f2485657db9591ba249dc917047dbd11b373cf
Author: David Mitchell ***@***.***>
Date:   Mon Dec 11 11:36:55 2023 +0000

    use rpp_foo_NN() and rpp_foo_IMM() widely

It's a bug in Cache::utLRU's XS code. Its find() method, when it fails to find a cache entry, pushes a NULL, rather than &PL_sv_undef, as the return value onto the stack.

It so happens that perl's scalar assign op can cope with assigning from a NULL pointer, but most of the perl core can't. So for example, if this line in 03_multi.t:

        my $got = $cache->find($key);

is changed to

        my $got = length($cache->find($key));

then it will crash on older perls too. The change in blead just detects NULLs on the stack earlier now, whereas before it would silently ignore them and likely crash further down the execution path.

Reported upstream.

It could be argued that the recently-added asserts should be reverted for now, since they were added quite late in the release cycle; but on the other hand, they only affect DEBUGGING builds, and the only thing they've broken so far is code that turned out to be broken anyway.

-- Never do today what you can put off till tomorrow.

jkeenan commented 8 months ago

...

Reported upstream.

Upstream bug report.

It could be argued that the recently-added asserts should be reverted for now, since they were added quite late in the release cycle; but on the other hand, they only affect DEBUGGING builds, and the only thing they've broken so far is code that turned out to be broken anyway.

My own hunch is that we can retain these asserts through the Feb 20 ("Contentious changes freeze") release, assess the data then, and revert if needed in late Feb or early March.

jkeenan commented 8 months ago

Pull request submitted upstream at https://github.com/gonzus/utlru/pull/2.

@gonzus

jkeenan commented 6 months ago

Pull request submitted upstream at gonzus/utlru#2.

@gonzus

Pull request accepted upstream, but no new CPAN release as of yet.

jkeenan commented 3 months ago

Pull request submitted upstream at gonzus/utlru#2. @gonzus

Pull request accepted upstream, but no new CPAN release as of yet.

New CPAN release of Cache-utLRU-0.003000 now installs against debugging perl. See: https://github.com/gonzus/utlru/pull/2 and http://www.cpantesters.org/cpan/report/006bf962-3ec2-11ef-b6f4-a8543243ea48. @gonzus++