https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8030

            Bug ID: 8030
           Summary: spamd SIGHUP restart failure when PERL5LIB is used
                    (t/spamd_hup.t)
           Product: Spamassassin
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: spamc/spamd
          Assignee: dev@spamassassin.apache.org
          Reporter: sid...@sidney.com
  Target Milestone: Undefined

This is showing up as a test failure in t/spamd_hup.t on a test machine that
uses local::lib to install modules for their test environment, which depends on
setting the PERL5LIB environment variable to the module install paths. It will
break spamd SIGHUP processing on any such machine, not just in tests.

t/SATest.pm contains code to make PERL5LIB work with our tests that run in
taint mode (which suppresses passing PERL5LIB to perl) by adding -I options
when it uses perl to start up spamd and spamassassin.

This fails in test t/spamd_hup.t when spamd receives a SIGHUP and tries to
restart by calling perl to run the spamd script, because it does not pass along
the -I options it was started with.

Here is an example report from a CPAN test machine with this problem. I created
a custom CPAN module with added debugging output so that this report dumped the
spamd STDERR log file when the error occurred. Notice that the spamd debug log
has a harmless warning "dbg: geodb: Geo::IP module load failed" that shows @INC
when spamd is first running, then later, the fatal error after the restart has
"Can't locate NetAddr/IP.pm in @INC" and shows the value of @INC after the
restart is missing all the directory paths that were there from PERL5LIB (which
is shown in the environment variables near the bottom of the report).

https://www.cpantesters.org/cpan/report/1de2d348-2282-11ed-8f4e-c962458f5e5b

I think the way to fix this is to save @INC into some @ORIGINAL_INC variable
immediately at the start of the script, similar to how $ORIGINAL_ARG0 and
$ORIGINAL_ARGV are saved, then use that to add -I options to the perl command
used at SIGHUP restart. Unfortunately I know of no way to determine the default
@INC that is compiled into perl, so those would be redundantly added to @INC.
There should be no harm in the restarted process having two copies of those in
its @INC. We can remove duplicates in the list of -I options used for the
restart call so that subsequent restarts don't keep increasing the number of
copies to more than 2.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to