• Issues with compiling libembperl-perl from source on Debian 12 Bookworm

    From Neil Gunton@21:1/5 to All on Wed Aug 16 20:40:01 2023
    Hi, I am having an issue with Embperl as supplied by Debian Bookworm src package.

    It completes the compile, albeit with some warnings, and my website
    (which has been running since 2000) mostly seems to work. However there
    is an issue with the [$ hidden $] meta command. It comes up with this in
    the Apache log:

    Warning in Perl code: Use of uninitialized value in subroutine entry

    This is for the line which has [$ hidden $]. I am aware that sometimes
    line numbers are a little skewed, but when I remove the [$ hidden $]
    line this warning goes away, so I'm pretty sure it is actually about
    that command.

    The strange thing is, other meta commands like [$ foreach $] do work, in
    fact most of Embperl seems to be working as expected (the home page on
    my site is quite complex, and it renders with no warnings now).

    One quirk I noticed is that there are now many warnings from my code,
    which didn't happen before on Debian Stretch (which I have just been
    upgrading from). All of these warnings are related to uninitialized
    variables, whereas previously Perl would quietly initialize, now it
    gives me a warning. Which means I have to go through many hundreds of
    instances where code like this gives a warning:

    if ($fdat{page} ne '')

    This gives a warning now if $fdat{page} isn't instantiated ($fdat is ok,
    just 'page' doesn't exist in that hash). I have to fix it by doing

    if (defined($fdat{page}) && $fdat{page} ne '')

    ... which is a bit of a pain, and makes the code more complex, but I
    don't know if it's maybe a good thing by and large since I guess Perl is
    just being more rigorous. Anyway, I can stand this, it's not a huge deal.

    The [$ hidden $] warning is more of a problem, since that is core
    Embperl functionality.

    Also there is an error in the 'make test' for the Embperl src package,
    as follows:

    PERL_DL_NONLAZY=0 "/usr/bin/perl" "-Iblib/lib" "-Iblib/arch" test.pl

    loading... ok

    Testing offline mode...

    #0 ascii... ok
    #1 pure.htm... ok
    #2 nooutput.htm... ok
    #3 nooutput.htm... ok
    #4 plain.htm... ok
    #5 plain.htm... ok
    #6 plain.htm... ok
    #7 plainblock.htm... ok
    #8 plainblock.htm... ok
    #15 error.htm... ok
    #16 error.htm... ok
    #17 error.htm... ok
    #27 errormismatch.htm...

    Expected 1 more error(s) in logfile

    Input: test/html/errormismatch.htm
    Output: test/tmp/out.htm
    Log: test/tmp/test.log
    Testparameter:
    version = 2
    errors = 1

    ERRORS detected! NOT all tests have been passed successfully

    cat: test/tmp/httpd.pid: No such file or directory
    make: *** [Makefile:1453: test_dynamic] Error 1

    I disregarded this initially and just installed the package to see if it
    would work anyway, which it largely does. I know this is considered
    unwise in general, but in my defense, historically there have been
    issues with the 'make test' on Embperl, it often appears to fail whereas
    the package is actually working just fine. So I learned to kind of skip
    the test errors, as they often turned out to be problems with the test
    suite itself rather than the actual package.

    The original author of the package, Gerald Richter, doesn't appear to
    interact on the Embperl mailing list any more. I haven't had any
    response from that list either, since yesterday at least. I wrote to one
    of the maintainers listed on the libembperl-perl page for Debian, and
    they told me to write to this list. I hope someone can give me some
    guidance on how to fix these issues, as Embperl is a very important
    package for me, it's central to my website.

    I am using a new install of Debian 12 Bookworm, and Apache is built from
    source using latest tarballs from Apache (2.4.57) APR (1.7.0) and
    mod_perl (2.0.12). Perl is reported as 5.36 as per Bookworm. Some of the warnings during the compile of Embperl:

    x86_64-linux-gnu-gcc -c -I/usr/local/httpd_perl/include -I/usr/local/httpd_perl/regex -I/usr/local/httpd_perl/os/unix -I/usr/local/apr/include/apr-1 -I/usr/src/libembperl-perl-2.5.0/xs
    -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -DMOD_PERL -DMP_COMPAT_1X -fgnu89-inline -DLINUX -O2 -g -DVERSION=\"2.5.0\"
    -DXS_VERSION=\"2.5.0\" -fPIC
    "-I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE" -DAPACHE -DAPACHE2 -DEP2
    -o Embperl.o Embperl.c
    x86_64-linux-gnu-gcc -c -I/usr/local/httpd_perl/include -I/usr/local/httpd_perl/regex -I/usr/local/httpd_perl/os/unix -I/usr/local/apr/include/apr-1 -I/usr/src/libembperl-perl-2.5.0/xs
    -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -DMOD_PERL -DMP_COMPAT_1X -fgnu89-inline -DLINUX -O2 -g -DVERSION=\"2.5.0\"
    -DXS_VERSION=\"2.5.0\" -fPIC
    "-I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE" -DAPACHE -DAPACHE2 -DEP2
    -o epmain.o epmain.c
    epmain.c: In function ‘DoLogError’:
    epmain.c:70:14: warning: assignment to ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    70 | aTHX = r -> pPerlTHX ;
    | ^
    epmain.c:72:14: warning: assignment to ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    72 | aTHX = a -> pPerlTHX ;
    | ^
    In file included from ep.h:195,
    from epmain.c:19:
    epmain.c: In function ‘CreateSessionCookie’:
    eppriv.h:24:22: warning: initialization of ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    24 | #define epTHX pTHX = r -> pPerlTHX
    | ^
    epmain.c:488:5: note: in expansion of macro ‘epTHX’
    488 | epTHX ;
    | ^~~~~
    epmain.c: In function ‘ResetRequest’:
    eppriv.h:24:22: warning: initialization of ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    24 | #define epTHX pTHX = r -> pPerlTHX
    | ^
    epmain.c:622:5: note: in expansion of macro ‘epTHX’
    622 | epTHX ;
    | ^~~~~
    epmain.c: In function ‘StartOutput’:
    eppriv.h:24:22: warning: initialization of ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    24 | #define epTHX pTHX = r -> pPerlTHX
    | ^
    eppriv.h:27:16: note: in expansion of macro ‘epTHX’
    27 | #define epTHX_ epTHX ;
    | ^~~~~
    epmain.c:680:5: note: in expansion of macro ‘epTHX_’
    680 | epTHX_
    | ^~~~~~

    More like that, I can capture the lot if it would help, but that gives
    an idea.

    Thanks,

    Neil Gunton

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Dominique Dumont@21:1/5 to All on Sat Sep 2 11:20:01 2023
    Hi

    On Wednesday, 16 August 2023 20:23:56 CEST Neil Gunton wrote:
    However there
    is an issue with the [$ hidden $] meta command. It comes up with this in
    the Apache log:

    Warning in Perl code: Use of uninitialized value in subroutine entry

    Which is harmless, Perl should do the "right" thing.

    Which means I have to go through many hundreds of
    instances where code like this gives a warning:

    if ($fdat{page} ne '')

    This gives a warning now if $fdat{page} isn't instantiated ($fdat is ok,
    just 'page' doesn't exist in that hash). I have to fix it by doing

    if (defined($fdat{page}) && $fdat{page} ne '')

    ... which is a bit of a pain, and makes the code more complex, but I
    don't know if it's maybe a good thing by and large since I guess Perl is
    just being more rigorous. Anyway, I can stand this, it's not a huge deal.

    You can write

    if ($fat{page})

    This will achieve the same result and should not give a warning.

    The [$ hidden $] warning is more of a problem, since that is core
    Embperl functionality.

    You will have to track where in Embperl is this warning generated and fix Embperl code.

    I suggest to use Devel::SimpleTrace to find exactly where is this warning generated.

    Also there is an error in the 'make test' for the Embperl src package,
    as follows:

    I can't help you there without spending a lot of time analyzing the tests.

    The original author of the package, Gerald Richter, doesn't appear to interact on the Embperl mailing list any more. I haven't had any
    response from that list either, since yesterday at least.

    That, unfortunately, happens quite often for old software. I quite recently took over upstream maintenance of pan because nobody else was volunteering and I did not want this package to be removed.

    I wrote to one
    of the maintainers listed on the libembperl-perl page for Debian, and
    they told me to write to this list. I hope someone can give me some
    guidance on how to fix these issues, as Embperl is a very important
    package for me, it's central to my website.

    May be you will have to take embperl over then.

    Perl is reported as 5.36 as per Bookworm. Some of the
    warnings during the compile of Embperl:

    epmain.c: In function ‘DoLogError’:
    epmain.c:70:14: warning: assignment to ‘PerlInterpreter *’ {aka ‘struct interpreter *’} from incompatible pointer type ‘struct perl_thread *’ [-Wincompatible-pointer-types]
    70 | aTHX = r -> pPerlTHX ;

    | ^

    Perl internals are also evolving and embperl XS code should be updated to follow this evolution.

    Another solution is to run your site in docker with an older version of Perl (and may be Apache). If your site is static, this can be acceptable solution of a security point of view (but security will be an issue since older versions of software would be exposed to internet).

    HTH

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)