Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash under the perl debugger in perl 5.22.3 and later #34

Closed
skington opened this issue Jun 28, 2017 · 3 comments
Closed

Crash under the perl debugger in perl 5.22.3 and later #34

skington opened this issue Jun 28, 2017 · 3 comments
Assignees
Labels

Comments

@skington
Copy link

ParseUtil::Domain, which uses autobox::Core, crashes for me under the debugger; I've narrowed it down to this test script. The only difference between the two subroutines is that one of them calls slice on the return value of the find_zone subroutine, and the other puts this return value into a temporary variable first before calling slice.

#!/usr/bin/env perl

use strict;
use warnings;
use Data::Dumper;
use autobox::Core;

print "Using autobox::Core $autobox::Core::VERSION\n";
print "using autobox $autobox::VERSION\n";
print "Using Want $Want::VERSION\n";
print "Safe:\n", Dumper(safe()), "\n";
print "Blows up under the debugger:\n", Dumper(like_parseutil()), "\n";

sub like_parseutil {
    my ($zone, $zone_ace, $domain_segments)
        = find_zone()->slice(qw(zone zone_ace domains));
}

sub safe {
    my $find_zone = find_zone();
    my ($zone, $zone_ace, $domain_segments)
        = $find_zone->slice(qw(zone zone_ace domains));
}

sub find_zone {
    return {
        zone     => 'example.com',
        zone_ace => 'example.com',
        domains  => [qw(example com)],
    };
}

Under perl 5.20.3 this works fine:

sam@chimera:tmp$ perl -V
Summary of my perl5 (revision 5 version 20 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=3.2.0-4-amd64, archname=x86_64-linux
    uname='linux chimera 3.2.0-4-amd64 #1 smp debian 3.2.68-1+deb7u3 x86_64 gnulinux '
    config_args='-de -Dprefix=/opt/perlbrew/perls/perl-5.20.3 -Aeval:scriptdir=/opt/perlbrew/perls/perl-5.20.3/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.2', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    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 -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.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 -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.13.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.13'
  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'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES
                        USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
  Locally applied patches:
	Devel::PatchPerl 1.38
  Built under linux
  Compiled at Sep 14 2015 18:05:41
  %ENV:
    PERLBREW_BASHRC_VERSION="0.78"
    PERLBREW_HOME="/home/sam/.perlbrew"
    PERLBREW_MANPATH="/opt/perlbrew/perls/perl-5.20.3/man"
    PERLBREW_PATH="/opt/perlbrew/bin:/opt/perlbrew/perls/perl-5.20.3/bin"
    PERLBREW_PERL="perl-5.20.3"
    PERLBREW_ROOT="/opt/perlbrew"
    PERLBREW_VERSION="0.78"
  @INC:
    /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3/x86_64-linux
    /opt/perlbrew/perls/perl-5.20.3/lib/site_perl/5.20.3
    /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3/x86_64-linux
    /opt/perlbrew/perls/perl-5.20.3/lib/5.20.3
    .
sam@chimera:tmp$ perl toy-slice.pl 
Using autobox::Core 1.33
using autobox 2.85
Using Want 0.29
Safe:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

Blows up under the debugger:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

sam@chimera:tmp$ perl -d toy-slice.pl 

Loading DB routines from perl5db.pl version 1.44_01
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

DB::DB(toy-slice.pl:8):	print "Using autobox::Core $autobox::Core::VERSION\n";
  DB<1> c                                                                       
Using autobox::Core 1.33
using autobox 2.85
Using Want 0.29
Safe:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

Blows up under the debugger:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

Under perl 5.22.3 and later (including 5.26.0), it crashes under the debugger:

sam@chimera:tmp$ perl -V
Summary of my perl5 (revision 5 version 22 subversion 3) configuration:
   
  Platform:
    osname=linux, osvers=3.2.0-4-amd64, archname=x86_64-linux
    uname='linux chimera 3.2.0-4-amd64 #1 smp debian 3.2.81-1 x86_64 gnulinux '
    config_args='-de -Dprefix=/opt/perlbrew/perls/perl-5.22.3 -Aeval:scriptdir=/opt/perlbrew/perls/perl-5.22.3/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2',
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.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 =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.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 -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.13.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.13'
  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'


Characteristics of this binary (from libperl): 
  Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV
                        PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP
                        PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
                        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
  Locally applied patches:
	Devel::PatchPerl 1.38
  Built under linux
  Compiled at Feb  2 2017 22:31:45
  %ENV:
    PERLBREW_BASHRC_VERSION="0.78"
    PERLBREW_HOME="/home/sam/.perlbrew"
    PERLBREW_MANPATH="/opt/perlbrew/perls/perl-5.22.3/man"
    PERLBREW_PATH="/opt/perlbrew/bin:/opt/perlbrew/perls/perl-5.22.3/bin"
    PERLBREW_PERL="perl-5.22.3"
    PERLBREW_ROOT="/opt/perlbrew"
    PERLBREW_VERSION="0.78"
  @INC:
    /opt/perlbrew/perls/perl-5.22.3/lib/site_perl/5.22.3/x86_64-linux
    /opt/perlbrew/perls/perl-5.22.3/lib/site_perl/5.22.3
    /opt/perlbrew/perls/perl-5.22.3/lib/5.22.3/x86_64-linux
    /opt/perlbrew/perls/perl-5.22.3/lib/5.22.3
    .
sam@chimera:tmp$ perl toy-slice.pl 
Using autobox::Core 1.33
using autobox 2.85
Using Want 0.29
Safe:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

Blows up under the debugger:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

sam@chimera:tmp$ perl -d toy-slice.pl

Loading DB routines from perl5db.pl version 1.49_001
Editor support available.

Enter h or 'h h' for help, or 'man perldebug' for more help.

DB::DB(toy-slice.pl:8):	print "Using autobox::Core $autobox::Core::VERSION\n";
  DB<1> c                                                                       
Using autobox::Core 1.33
using autobox 2.85
Using Want 0.29
Safe:
$VAR1 = 'example.com';
$VAR2 = 'example.com';
$VAR3 = [
          'example',
          'com'
        ];

Can't call method "slice" on unblessed reference at toy-slice.pl line 15.
 at toy-slice.pl line 15.
	main::like_parseutil() called at toy-slice.pl line 12
@scottwalters
Copy link
Collaborator

Thanks for the report. My first guess here is that this can be reduced to a bug in autobox. I'll try to prove/disprove that theory.

@skington
Copy link
Author

skington commented Jul 2, 2017

Thanks for looking into it!

@chocolateboy
Copy link
Collaborator

chocolateboy commented Apr 20, 2018

@skington Thanks for reporting this! It should be fixed in autobox v2.86, which I've just released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants