Bug 1057 - SpamAssassin.pm sed_path does not correctly expand __prefix__
Summary: SpamAssassin.pm sed_path does not correctly expand __prefix__
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: All All
: P2 major
Target Milestone: ---
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-04 20:31 UTC by Brian Landers
Modified: 2002-10-09 06:59 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 Brian Landers 2002-10-04 20:31:44 UTC
There's a bug in SpamAssassin's sed_path method that causes it to not expand the
__prefix__ macro correctly.  A patch is below.

--- SpamAssassin.pm.dist        Fri Oct  4 23:23:55 2002
+++ SpamAssassin.pm     Fri Oct  4 23:24:06 2002
@@ -916,7 +916,7 @@
   return undef if (!defined $path);
   $path =~ s/__local_rules_dir__/$self->{LOCAL_RULES_DIR} || ''/ges;
   $path =~ s/__def_rules_dir__/$self->{DEF_RULES_DIR} || ''/ges;
-  $path =~ s/__prefix__/$self->{PREFIX} || $Config{prefix}/gs;
+  $path =~ s/__prefix__/$self->{PREFIX} || $Config{prefix}/ges;
   $path =~ s/^\~([^\/]*)/$self->expand_name($1)/es;
   $path;
 }
Comment 1 Justin Mason 2002-10-09 07:09:43 UTC
I don't understand this btw.  How can $Config{prefix} be unset or ''?
Comment 2 Brian Landers 2002-10-09 07:17:40 UTC
$Config{prefix} isn't unset.  It comes from Perl.  The problem is, without the
/e option to the regexp, the '$self->{PREFIX} || $Config{prefix}' never gets
evaluated as code, but just gets substituted as a string.  I hit this bug
because my config files live somewhere other than /usr/share/spamassassin, and
weren't being found.  My $Config{prefix} was correct, so I couldn't understand
why SA wasn't looking there for the config files.
Comment 3 Theo Van Dinter 2002-10-09 10:49:55 UTC
Subject: Re: [SAdev]  SpamAssassin.pm sed_path does not correctly expand __prefix__

On Wed, Oct 09, 2002 at 07:09:44AM -0700, bugzilla-daemon@hughes-family.org wrote:
> I don't understand this btw.  How can $Config{prefix} be unset or ''?

Module isn't loaded?

$ perl -e 'print $Config{prefix},"\n"'

$ perl -e 'use Config; print $Config{prefix},"\n"'
/usr


I haven't had time to look at the code for this yet.
Comment 4 Justin Mason 2002-10-09 14:59:10 UTC
no, it's definitely loaded.  I think Brian's correct,
so I think the bug's now fixed -- marking as such ;)