Got to the bottom of this one, and it turns out it's a bug in Perl-5.6.1 w/o threads
perl_destruct(perl); perl_free(perl);
Doesn't cleanup sufficiently and a subsequent perl_parse() will segfault
<Makefile> PERL := perl
all: test
CFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ccopts) LDFLAGS=$(shell $(PERL) -MExtUtils::Embed -e ldopts)
test: pbug
-./pbug
clean:
@rm -f *.o pbug
</Makefile><pbug.c> #include <EXTERN.h> #include <perl.h>
PerlInterpreter *perl;
void init(void) {
char *embedding[] = { "", "-e", "0" };
perl = perl_alloc();
perl_construct(perl);
{
dTHXa(perl);
PL_perl_destruct_level = 2;
}
perl_parse(perl, NULL, 3, embedding, NULL);
return;
}void fini(void) {
dTHXa(perl);
PL_perl_destruct_level = 2;
perl_destruct(perl);
perl_free(perl);
}int main(void) {
init();
fini();
init();
printf("This perl is okay!\n");
exit(0);
}
</pbug.c>$> make test PERL=perl-5.8.6 This Perl is okay! $> make clean $> make test PERL=perl-5.6.1-nothreads Segmentation fault (core dumped)
-------------------------------------------------------------------------------- Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5 http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
signature.asc
Description: OpenPGP digital signature
