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

Perl segfault w/ specific weird syntax. #884

Closed
p5pRT opened this issue Nov 23, 1999 · 2 comments
Closed

Perl segfault w/ specific weird syntax. #884

p5pRT opened this issue Nov 23, 1999 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 23, 1999

Migrated from rt.perl.org#1816 (status was 'resolved')

Searchable as RT1816$

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 1999

From @raindrift

I'm getting a segfault under a particular little strange condition. The
smallest bit of code I've managed to reproduce it with is as follows​:

my $var1 = '';
my $var2 = '';
@​arr1 = qw( );
sub

If you save that in a file, let's call it bug.pl, and then execute​:

perl -e "require 'bug.pl'"

you'll get a segfault (or, at least, I do). If you just execute it, it's
fine.

The perl syntax here is obviously incorrect, but finding the bit that's
incorrect without any real error messages is a bit vexing. Of course, this
isn't a big deal, but if one's just hunting for things to fix... :)

For some reason, the perl distributed with RH6 doesn't seem to have perlbug
with it, so here's the output from perl -V, and below it you'll find a stack
trace of the core file (c/o gdb)​:

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration​:
  Platform​:
  osname=linux, osvers=2.2.1-ac1, archname=i386-linux
  uname='linux porky.devel.redhat.com 2.2.1-ac1 #1 smp mon feb 1 17​:44​:44 est 1999 i686 unknown '
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  Compiler​:
  cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
  cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
  stdchar='char', d_stdstdio=undef, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
  libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Built under linux
  Compiled at Apr 6 1999 23​:34​:07
  @​INC​:
  /usr/lib/perl5/5.00503/i386-linux
  /usr/lib/perl5/5.00503
  /usr/lib/perl5/site_perl/5.005/i386-linux
  /usr/lib/perl5/site_perl/5.005
  .

And the stack trace​:

#0 0x806f73f in Perl_pad_free ()
#1 0x806f903 in Perl_op_free ()
#2 0x806f7fa in Perl_op_free ()
#3 0x806f7fa in Perl_op_free ()
#4 0x809fe67 in Perl_sv_compile_2op ()
#5 0x80a08a1 in Perl_pp_require ()
#6 0x80b148d in Perl_runops_standard ()
#7 0x80592b8 in perl_run ()
#8 0x805782f in main ()
#9 0x400a5cb3 in __libc_start_main (main=0x80577c0 <main>, argc=3,
  argv=0xbffff8b4, init=0x8056af4 <_init>, fini=0x80b14fc <_fini>,
  rtld_fini=0x4000a350 <_dl_fini>, stack_end=0xbffff8ac)
  at ../sysdeps/generic/libc-start.c​:78

Thanks!
-Ian

@p5pRT
Copy link
Author

p5pRT commented Nov 23, 1999

From @andk

On Tue, 23 Nov 1999 00​:12​:13 -0600, Ian Baker <ian@​sonic.net> said​:

Hi. I'm running Perl, version 5.005_03 built for i386-linux

I'm getting a segfault under a particular little strange condition. The
smallest bit of code I've managed to reproduce it with is as follows​:

my $var1 = '';
my $var2 = '';
@​arr1 = qw( );
sub

If you save that in a file, let's call it bug.pl, and then execute​:

perl -e "require 'bug.pl'"

Confirmed for current snapshot of perl5.005_62+. Can be reduced to

perl -e '
eval q{my $var1 = "";
my $var2 = "";
@​arr1 = qw();
sub};
'

As I have a debugging perl here, I'll add my stack trace​:

(gdb) bt
#0 0x8080eb2 in Perl_pad_free (po=4) at op.c​:508
#1 0x80812dd in S_op_clear (o=0x813c448) at op.c​:786
#2 0x8081109 in Perl_op_free (o=0x813c448) at op.c​:685
#3 0x80810ae in Perl_op_free (o=0x813c088) at op.c​:673
#4 0x80810ae in Perl_op_free (o=0x813c508) at op.c​:673
#5 0x80eaca7 in S_doeval (gimme=0, startop=0x0) at pp_ctl.c​:2635
#6 0x80ec829 in Perl_pp_require () at pp_ctl.c​:3010
#7 0x80aea4b in Perl_runops_debug () at run.c​:56
#8 0x805b951 in S_run_body (args=0xbffffaec) at perl.c​:1201
#9 0x80de113 in Perl_vdefault_protect (pcur_env=0xbffffb00, excpt=0xbffffbb0,
  body=0x805b7e0 <S_run_body>, args=0xbffffacc) at scope.c​:45
#10 0x80de029 in Perl_default_protect (pcur_env=0xbffffb00, excpt=0xbffffbb0,
  body=0x805b7e0 <S_run_body>) at scope.c​:26
#11 0x805b563 in perl_run (my_perl=0x812ec08) at perl.c​:1134
#12 0x805898f in main (argc=3, argv=0xbffffbe4, env=0xbffffbf4)
  at perlmain.c​:53

--
andreas

Summary of my perl5 (revision 5.0 version 5 subversion 63) configuration​:
  Platform​:
  osname=linux, osvers=2.2.12, archname=i586-linux
  uname='linux hohenstaufen.in-berlin.de 2.2.12 #2 smp sat oct 2 11​:10​:42 cest 1999 i586 unknown '
  config_args='-Dprefix=/sources-perl/inst/perl5.005_62..4590g -Doptimize=-g -des -Dusemymalloc'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef useperlio=undef d_sfio=undef
  use64bits=undef usemultiplicity=undef
  Compiler​:
  cc='cc', optimize='-g', gccversion=2.7.2.3
  cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include'
  ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING -I/usr/local/include'
  stdchar='char', d_stdstdio=define, usevfork=false
  intsize=4, longsize=4, ptrsize=4, doublesize=8
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries​:
  ld='cc', ldflags =' -L/usr/local/lib'
  libpth=/usr/local/lib /lib /usr/lib
  libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
  libc=/lib/libc-2.0.7.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
  cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl)​:
  Compile-time options​: DEBUGGING
  Built under linux
  Compiled at Nov 18 1999 16​:24​:18
  @​INC​:
  /sources-perl/inst/perl5.005_62..4590g/lib/5.00563/i586-linux
  /sources-perl/inst/perl5.005_62..4590g/lib/5.00563
  /sources-perl/inst/perl5.005_62..4590g/lib/site_perl/5.00563/i586-linux
  /sources-perl/inst/perl5.005_62..4590g/lib/site_perl
  .

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

No branches or pull requests

1 participant