Bug#486069: perl: embedding perl hangs on hppa without PERL_SYS_INIT3() since 5.10.0

Julien ÉLIE julien at trigofacile.com
Sun Jun 29 07:21:49 UTC 2008


Hi Russ,

> At a guess, Perl is trying to read from standard input somewhere.  I
> don't, however, know why that change would cause the nnrpd filters to
> begin to do so.  It sounds like it's hanging in the Perl filter until the
> network connection is closed for some reason.

You're quite right!

I have just read there (_Advanced Perl programming_, O'Reilly):

    http://www.unix.com.ua/orelly/perl/advprog/ch19_03.htm

%%
It so happens that perl_parse does some crucial initializations, so we have to
call it.  [In fact, perl_parse should be called at most once, because it reinitializes
the interpreter without checking that it has already been done.]
If we give it a null argc/argv array, it has the unfortunate property of waiting
on standard input, as you normally expect Perl to do.  For this reason, we give it
the shortest possible script that compiles cleanly and doesn't take any time to finish,
as shown in the following command line:

    perl -e 0
%%


And, indeed, it works pretty well with:

        int argc = 3;
        const char *argv[] = { "innd", "-e", "0", NULL };
        char *env[]  = { NULL };
#ifdef PERL_SYS_INIT3
        PERL_SYS_INIT3(&argc, &argv, &env);
#endif
        PerlCode = perl_alloc();
        perl_construct(PerlCode);
        perl_parse(PerlCode, xs_init, argc, (char **)argv, env) ;
[...]



I believe they should emphasize this fact more in perlembed.pod because it is true
that they put:
    char *embedding[] = { "", "-e", "0" };
but they do not explain why, and whether it is mandatory!


Well, I will commit that to STABLE too and maybe INN 2.4.5 will now be ready
to be released.  Unless another serious issue arises.

-- 
Julien ÉLIE

« Aliud est celare, aliud tacere. »



More information about the inn-workers mailing list