Bug 7413 - sa_compile.t fails to run as non-privileged user under make disttest
Summary: sa_compile.t fails to run as non-privileged user under make disttest
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Regression Tests (show other bugs)
Version: 3.4 SVN branch
Hardware: All All
: P2 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-23 15:16 UTC by Kevin A. McGrail
Modified: 2018-05-12 00:06 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
Add explicit paths to 'make' invocations in sa-compile so that make disttest passes. patch None Bill Cole [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin A. McGrail 2017-04-23 15:16:48 UTC
t/sa_compile.t fails on make disttest when you run make disttest as a non-privileged user.

Error output looks like:

t/sa_compile.t .................... 'cd /home/kmcgrail/relbuild/Mail-SpamAssassin-3.4.2/t/log/d.sa_compile/build/x && make install 2>&1' failed: exit 2 at t/SATest.pm line 991.
t/sa_compile.t .................... Dubious, test returned 2 (wstat 512, 0x200)
Failed 5/5 subtests 
...
t/sa_compile.t                  (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 5 tests but ran 0.
Files=166, Tests=3026, 409 wallclock secs ( 1.39 usr  0.28 sys + 148.09 cusr 20.40 csys = 170.16 CPU)
Result: FAIL

running just prove -v t/sa-compile.t worked. 

Also, running make disttest does not fail as root but the sa_compile.t test is skipped.  Not sure why it's skipped...  This is the first release that I have had re2c on the box doing the builds so I don't think this is new or a 3.4.2 blocker.
Comment 1 Bill Cole 2017-04-23 22:01:03 UTC
I have replicated this on MacOS 10.11.6 and by running 'make disttest TEST_VERBOSE=1 TEST_FILES=t/sa_compile.t ' got more details from the failure that imply it to be a universal issue:

Manifying 8 pod documents
Manifying 73 pod documents
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/opt/local/lib/perl5/site_perl/5.24'
Do not have write permissions on '/opt/local/lib/perl5/site_perl/5.24'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 at -e line 1.
make[2]: *** [pure_site_install] Error 13
'cd /Users/dad/spamassassin-342/Mail-SpamAssassin-3.4.2/t/log/d.sa_compile/build/x && make install 2>&1' failed: exit 2 at t/SATest.pm line 991.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 5/5 subtests 


IOW: 'make disttest' is trying to install SA "for real" rather than in some test directory. Seems unwise...
Comment 2 Kevin A. McGrail 2017-04-24 14:53:38 UTC
Thanks, Bill.  Do you see it as a blocker?
Comment 3 Bill Cole 2017-04-25 01:25:25 UTC
(In reply to Kevin A. McGrail from comment #2)
> Thanks, Bill.  Do you see it as a blocker?

Absolutely not. I'm not even sure it's a bug, since I suspect that 'make disttest' makes no sense without explicitly setting PREFIX and DESTDIR.
Comment 4 Bill Cole 2018-05-11 21:18:04 UTC
(In reply to Bill Cole from comment #3)
> (In reply to Kevin A. McGrail from comment #2)
> > Thanks, Bill.  Do you see it as a blocker?
> 
> Absolutely not. I'm not even sure it's a bug, since I suspect that 'make
> disttest' makes no sense without explicitly setting PREFIX and DESTDIR.

Well, it does. Also, this may really be a blocker because 'make disttest' either fails or puts bogus compiled rules files under the unmodified PREFIX. 

I have also determined that this is NOT dependent on PREFIX, but rather on the permissions of PREFIX. It was masked on my systems by the fact that I was using a non-root account with write access to /usr/local but not /opt/local. 

The root cause is that sa-compile builds a Makefile.PL of its own from which it calles MakeMaker to build a Makefile that it then uses to build and install the compiled rules and associated files.

With both 'make test' and 'make disttest' sa-compile handles relocation of the install points of body_0.bundle, body_0.pm, and bases_body_0.pl correctly, however 'make test' drops a man page (Mail::SpamAssassin::CompiledRegexps::body_0.3pm) and a perllocal.pod file in paths under a temp directory ($TMPDIR/<mktemp directory>/ignored/) and leaves them there while 'make disttest' tries to put them under the "real" PREFIX.
Comment 5 Bill Cole 2018-05-12 00:06:37 UTC
Created attachment 5569 [details]
Add explicit paths to 'make' invocations in sa-compile so that make disttest passes.

This patch works but should not be needed. I am not satisfied with it.