Bug 5617 - sa-compile fails when run from cron - can't find re2c
Summary: sa-compile fails when run from cron - can't find re2c
Status: RESOLVED WORKSFORME
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: sa-compile (show other bugs)
Version: 3.2.3
Hardware: Other FreeBSD
: P5 minor
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-20 08:11 UTC by sandys
Modified: 2007-08-20 09:43 UTC (History)
0 users



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 sandys 2007-08-20 08:11:17 UTC
I have a nightly cron set up to run this command:
/usr/local/bin/sa-update && /usr/local/bin/sa-compile

When sa-compile is run this way via cron, the sa-compile portion of this fails 
with the following error:

re2c -i -b -o scanner1.c scanner1.re
Can't exec "re2c": No such file or directory at /usr/local/bin/sa-compile line 
281, <$fh> line 2622.
command failed! at /usr/local/bin/sa-compile line 282, <$fh> line 2622.

This appears to be caused by the following line in the sa-compile code: 'my 
$cmd = "re2c -i -b -o scanner$_.c scanner$_.re";'.  When jobs are run from 
cron under our FreeBSD setup (and I suspect on most others), they require the 
full path to commands to be specified - ex. /usr/local/bin/re2c rather than 
just re2c.  

I've resolved this issue locally by updating that line in sa-compile to 
read "my $cmd = "/usr/local/bin/re2c -i -b -o scanner$_.c scanner$_.re";

Please change future release of Spamassassin to include the full path to re2c 
in the code for sa-compile.

Thanks!
Comment 1 Theo Van Dinter 2007-08-20 08:33:59 UTC
We can't really do that since people would have re2c installed in various locations.

Perhaps you just need to set your PATH appropriately in the crontab.
Comment 2 sandys 2007-08-20 08:42:08 UTC
(In reply to comment #1)
> We can't really do that since people would have re2c installed in various 
locations.
> Perhaps you just need to set your PATH appropriately in the crontab.

Boy do I feel stupid!  I never even noticed that PATH command at the top of my 
cron file.  I will fix it there and thanks for your prompt response!
Comment 3 Justin Mason 2007-08-20 09:43:23 UTC
cool, closing