Skip to content

try_yyparse breaks Attribute::Handlers #20396

@demerphq

Description

@demerphq

Description
In response to #20161 we applied c304acb which seems to cause trouble with certain types of Attribute::Handlers. Specifically when handler contains attributes which die during eval to perl :Sig(s, foo) we end up malbehaving in different ways depending on the exact code involved.

Disabling c304acb (or reverting it) fixes the problem, but it is not clear to me if it is the cause of the problem, or whether it just exposes another problem. I think possibly the latter, but i am not sure.

I will post more information about what i know about this ticket as replies.

Steps to Reproduce

Code that fails with c304acb, note the s, ARRAY, but works in older perls (perhaps accidentally)

$ cat ~/scratch/t_eixo_bad.pl 
use Eixo::Base::Util;
sub concat : Sig(s, ARRAY) { }
warn "Done\n";

Code that works with c304acb and in older perls, note the i, ARRAY.

$ cat ~/scratch/t_eixo_ok.pl 
use Eixo::Base::Util;
sub concat : Sig(i, ARRAY) { }
warn "Done\n";

Reduced module with just a little of debug output to see what is going on:

$ cat ~/scratch/lib/Eixo/Base/Util.pm 
package Eixo::Base::Util;
use strict;
use warnings;

use Attribute::Handlers;
use Carp qw(cluck);
use Data::Dumper;

sub UNIVERSAL::Sig :ATTR(CODE) { 
    #cluck("In 'Sig': ", Dumper(\@_));
}
1;

with this I can reproduce the issues with:

./perl -Ilib -I/home/yorton/scratch/lib ~/scratch/t_eixo_bad.pl

from inside of a perl build directory.

Expected behavior
We shouldn't have problems from these examples.

Perl configuration

Summary of my perl5 (revision 5 version 37 subversion 5) configuration:
  Derived from: ac9ba9d6a3979c516130176f25df5d0ac898a553
  Ancestor: f08b7a33d99b9b204260e108bc1789c5392aff36
  Platform:
    osname=linux
    osvers=5.14.0-1052-oem
    archname=x86_64-linux-thread-multi
    uname='linux oncidium 5.14.0-1052-oem #59-ubuntu smp fri sep 9 09:37:59 utc 2022 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
  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='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='gcc'
    ldflags =' -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
    libs=-lpthread -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -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 -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_HASH_FUNC_SIPHASH13
    PERL_HASH_USE_SBOX32
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_TRACK_MEMPOOL
    PERL_USE_DEVEL
    PERL_USE_SAFE_PUTENV
    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
    0d049322e803fef628ef35405a6bf6f5b9787d28
    3cb2fc532cff5c41e281fb8471b78a97c95180df
    ac9ba9d6a3979c516130176f25df5d0ac898a553
  Built under linux
  Compiled at Oct 14 2022 13:20:57
  %ENV:
    PERLBREW_CONFIGURE_FLAGS="-de -Dcc=ccache\ gcc -Dld=gcc"
    PERLBREW_HOME="/home/yorton/.perlbrew"
    PERLBREW_MANPATH="/home/yorton/perl5/perlbrew/perls/perl-5.34.1/man"
    PERLBREW_PATH="/home/yorton/perl5/perlbrew/bin:/home/yorton/perl5/perlbrew/perls/perl-5.34.1/bin"
    PERLBREW_PERL="perl-5.34.1"
    PERLBREW_ROOT="/home/yorton/perl5/perlbrew"
    PERLBREW_SHELLRC_VERSION="0.88"
    PERLBREW_VERSION="0.88"
  @INC:
    lib
    /usr/local/lib/perl5/site_perl/5.37.5/x86_64-linux-thread-multi
    /usr/local/lib/perl5/site_perl/5.37.5
    /usr/local/lib/perl5/5.37.5/x86_64-linux-thread-multi
    /usr/local/lib/perl5/5.37.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions