[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5658) slapo-perl symbol updates



rra@stanford.edu writes:

> It's a general change to the libperl API and may not only affect HPPA.
> You're apparently now required to call those macros, and in the future
> they may have more effects.

Here is a patch, untested alas because I don't have time at the moment to
set up something with back-perl.  It compiles.  I'm not fully sure that
the handling of embedded and argc is correct.

Perl 5.10 (and some earlier versions) require calling some additional
macros around Perl interpreter setup and shutdown.  Not doing these
calls causes problems on HPPA at least, and may affect other platforms
in the future.  This patch adds the additional code modelled on the
perlembed man page and a working patch for INN.

Debian Bug#495069
ITS #5658

--- openldap.orig/servers/slapd/back-perl/close.c
+++ openldap/servers/slapd/back-perl/close.c
@@ -30,6 +30,9 @@
 {
 	perl_destruct(PERL_INTERPRETER);
 	perl_free(PERL_INTERPRETER);
+#ifdef PERL_SYS_TERM
+	PERL_SYS_TERM();
+#endif
 	PERL_INTERPRETER = NULL;
 
 	ldap_pvt_thread_mutex_destroy( &perl_interpreter_mutex );	
--- openldap.orig/servers/slapd/back-perl/init.c
+++ openldap/servers/slapd/back-perl/init.c
@@ -37,6 +37,7 @@
 )
 {
 	char *embedding[] = { "", "-e", "0" };
+	int argc = 3;
 
 	bi->bi_open = NULL;
 	bi->bi_config = 0;
@@ -77,9 +78,15 @@
 	
 	ldap_pvt_thread_mutex_init( &perl_interpreter_mutex );
 
+#ifdef PERL_SYS_INIT3
+	PERL_SYS_INIT3(&argc, &embedding, (char **)NULL);
+#endif
 	PERL_INTERPRETER = perl_alloc();
 	perl_construct(PERL_INTERPRETER);
-	perl_parse(PERL_INTERPRETER, perl_back_xs_init, 3, embedding, (char **)NULL);
+#ifdef PERL_EXIT_DESTRUCT_END
+	PL_exit_flags |= PERL_EXIT_DESTRUCT_END;
+#endif
+	perl_parse(PERL_INTERPRETER, perl_back_xs_init, argc, embedding, (char **)NULL);
 	perl_run(PERL_INTERPRETER);
 	return 0;
 }

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>