Bug 5591 - make test fails at spamd_hup test on Solaris 9, 10
Summary: make test fails at spamd_hup test on Solaris 9, 10
Status: RESOLVED WONTFIX
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Building & Packaging (show other bugs)
Version: 3.2.3
Hardware: Sun Solaris
: P2 normal
Target Milestone: Future
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-10 12:34 UTC by Larry Rosenbaum
Modified: 2011-10-28 16:23 UTC (History)
3 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Larry Rosenbaum 2007-08-10 12:34:49 UTC
Solaris 9, SA 3.2.3, Perl 5.8.8
"make test" gives the following error:
#  t/spamd_hup.t line 40 is:   ok (-e $pid_file) or warn "$pid_file does not 
exist post restart";
log/spamd.pid does not exist post restart at t/spamd_hup.t line 40.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 844.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 844.
...

However, if I test manually with
prove -v t/spamd_hup.t
then the test passes.  If I check the spamd.err.1 file, the successful test 
looks like this:

...
[5346] warn: spamd: restarting using '/usr/local/bin/perl -T -
w ../spamd/spamd.raw -D -x -s stderr -C log
/test_rules_copy --siteconfigpath log/localrules.tmp -p 38110 -A 127.0.0.1 -L -
r log/spamd.pid -s log/d.spamd_hup/spamd.err.1.timestamped'
syswrite() on closed filehandle STDLOG 
at ../blib/lib/Mail/SpamAssassin/Logger/File.pm line 81.
[5346] dbg: logger: adding facilities: all
...

where the case that failed looks like this:

...
[23141] warn: spamd: restarting using '../spamd/spamd.raw -D -x -s stderr -C 
log/test_rules_copy --siteconfigpath log/localrules.tmp -p 55905 -A 127.0.0.1 -
L -r log/spamd.pid -s log/d.spamd_hup/spamd.err.1.timestamped'
syswrite() on closed filehandle STDLOG 
at ../blib/lib/Mail/SpamAssassin/Logger/File.pm line 81.
"-T" is on the #! line, it must also be used on the command line 
at ../spamd/spamd.raw line 1.

So what happened to the "/usr/local/bin/perl -T -w" ??
Comment 1 Larry Rosenbaum 2008-01-15 12:21:04 UTC
This bug still exists in v3.2.4.  I have been able to get more information on 
why it occurs on some of our systems but not on others.

The Perl executable is installed in /usr/local/bin with a symlink 
from /usr/bin:

lrwxrwxrwx   1 root           19 Jul 18  2005 /usr/bin/perl -
> /usr/local/bin/perl
-rwxr-xr-x   2 root      1141560 May 10  2007 /usr/local/bin/perl

If the PATH has /usr/local/bin before /usr/bin, then the spamd_hup test runs 
without error.
If the PATH has /usr/bin before /usr/local/bin, then the spamd_hup test fails 
as shown above.

I think that the problem is in this section of spamd:

  my $perl = Mail::SpamAssassin::Util::untaint_var($^X);
  my @execs = ( $perl, "-T", "-w", $ORIG_ARG0, @ORIG_ARGV );

  if ($perl eq $perl_from_hashbang_line) {
    # we're using the same perl as the script uses on the #! line;
    # we can safely just exec the script
    @execs = ( $ORIG_ARG0, @ORIG_ARGV );
  }

  warn "spamd: restarting using '" . join (' ', @execs) . "'\n";
  exec @execs;

When /usr/bin comes first in the PATH, the block controlled by the "if" is 
executed.  Since the "-T" switch is NOT saved in @ORIG_ARGV, the exec goes 
boom.  I don't know the best way to fix the problem, but it seems like leaving 
out the "if" block will fix it.
Comment 2 Anatoly Pugachev 2009-04-14 08:54:48 UTC
Solaris 10, Sa 3.2.5, OS installed perl 5.8.4

bug is still there:
$ tail t/log/d.spamd_hup/spamd.err.1
[10866] warn: spamd: restarting using '../spamd/spamd.raw -D -x -s stderr -C log/test_rules_copy --siteconfigpath log/localrules.tmp -p 43630 -A 127.0.0.1 -L -r log/spamd.pid -s log/d.spamd_hup/spamd.err.1.timestamped'
syswrite() on closed filehandle STDLOG at ../blib/lib/Mail/SpamAssassin/Logger/File.pm line 81.
Too late for "-T" option at ../spamd/spamd.raw line 1.


completes test just fine:
/usr/perl5/5.8.4/bin/prove -v t/spamd_hup.t
...
Files=1, Tests=110, 46 wallclock secs (14.79 cusr +  1.62 csys = 16.41 CPU)


Comment 3 Justin Mason 2009-04-14 09:51:23 UTC
needs a quick triage for 3.3.0.
Comment 4 Justin Mason 2009-07-05 14:13:24 UTC
so -- I can't reproduce this now on Solaris 10 with 3.3.0. I'm going to move it off the milestone, but pipe up if it's still happening with that code....
Comment 5 Anatoly Pugachev 2009-07-06 01:35:13 UTC
it's still here for me:

$ wget http://people.apache.org/~jm/devel/Mail-SpamAssassin-3.3.0.tar.bz2
$ bzip2 -dc Mail-SpamAssassin-3.3.0.tar.bz2 | tar -xf -
$ cd Mail-SpamAssassin-3.3.0
$ echo | perl Makefile.PL && make
$ cat t/config.dist | sed 's/run_long_tests=n/run_long_tests=y/' > t/config # else it will be skipped by 'make test'

$ make test TEST_FILES="t/spamd_hup.t"
/usr/bin/perl build/mkrules --exit_on_no_src --src rulesrc --out rules --manifest MANIFEST --manifestskip MANIFEST.SKIP
no source directory found: exiting
/usr/bin/perl build/preprocessor  -Mvars  -DVERSION="3.003000"  -DPREFIX="/usr/perl5/5.8.4"  -DDEF_RULES_DIR="/usr/perl5/5.8.4/share/spamassassin"  -DLOCAL_RULES_DIR="/usr/perl5/5.8.4/etc/mail/spamassassin"  -DLOCAL_STATE_DIR="/usr/perl5/5.8.4/var/spamassassin"  -DINSTALLSITELIB="/usr/perl5/site_perl/5.8.4"  -DCONTACT_ADDRESS="the administrator of that system" -Msharpbang  -Mconditional  -DPERL_BIN="/usr/bin/perl"  -DPERL_WARN=""  -DPERL_TAINT="" -m755 -isa-update.raw -osa-update
cp sa-update blib/script/sa-update
/usr/bin/perl "-MExtUtils::MY" -e "MY->fixin(shift)" blib/script/sa-update
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/spamd_hup.t
t/spamd_hup....ok 1/110# Failed test 5 in t/spamd_hup.t at line 40           
#  t/spamd_hup.t line 40 is:   ok (-e $pid_file) or warn "$pid_file does not exist post restart";
log/spamd.pid does not exist post restart at t/spamd_hup.t line 40.
t/spamd_hup....NOK 5/110Could not open pid file log/spamd.pid: No such file or directory
t/spamd_hup....ok 6/110Exiting subroutine via next at t/SATest.pm line 890.  
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
Could not open pid file log/spamd.pid: No such file or directory
Exiting subroutine via next at t/SATest.pm line 890.
t/spamd_hup....FAILED tests 5, 7-110                                         
        Failed 105/110 tests, 4.55% okay
Failed Test   Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/spamd_hup.t              110  105  5 7-110
Failed 1/1 test scripts. 105/110 subtests failed.
Files=1, Tests=110, 63 wallclock secs ( 0.83 cusr +  0.25 csys =  1.08 CPU)
Failed 1/1 test programs. 105/110 subtests failed.
*** Error code 29
make: Fatal error: Command failed for target `test_dynamic'


completes test just fine:
/usr/perl5/5.8.4/bin/prove -v t/spamd_hup.t
...
All tests successful.
Files=1, Tests=110, 45 wallclock secs ( 8.98 cusr +  2.96 csys = 11.94 CPU)
Comment 6 Bill Barnes 2010-01-17 12:59:39 UTC
Same problem with AIX. /usr/bin/perl was symbolically linked to /usr/opt/perl5/bin/perl5.8.8 and /usr/opt/perl5/bin was not in $PATH. A fast work around for me was to temporarily put /usr/opt/perl5/bin as the first dir in $PATH, remake spamassassin. make test for spamd_hup.t then passed.

make install worked normally and I put /usr/opt/perl5/bin in my PATH. spamassassin --lint doesn't complained and that is as far as I am at this writing.
Comment 7 Kevin A. McGrail 2011-10-28 16:23:28 UTC
(In reply to comment #6)
> Same problem with AIX. /usr/bin/perl was symbolically linked to
> /usr/opt/perl5/bin/perl5.8.8 and /usr/opt/perl5/bin was not in $PATH. A fast
> work around for me was to temporarily put /usr/opt/perl5/bin as the first dir
> in $PATH, remake spamassassin. make test for spamd_hup.t then passed.
> 
> make install worked normally and I put /usr/opt/perl5/bin in my PATH.
> spamassassin --lint doesn't complained and that is as far as I am at this
> writing.

Closing as a system configuration issue.