SpamAssassin lint errors: Subroutines from File::Spec redefined after installing razor agents.

Fri, 13/12/2024 - 19:57 -- James Oakley

I just had to solve one of those problems where no amount of internet searches found someone with the exact same problem as me, who had solved it.

Having finally got there, I thought I'd write it up. I'll find it again in the future. But it may just be that there are others with a similar enough problem that this helps.

My situation

I run a web server that also handles inbound email. It runs Almalinux 9, and has Postfix as it's MTA. I use spamassassin for spam filtering.

I wanted to take advantage of some crowd tools to improve how spamassassin works.

I had installed pyzor and had been running it without any problems.

But I wanted to install two further hashed lookup tools, that complement rather than replace pyzor: dcc and razor.

I installed both before I found the problem, but I think it was razor that caused the problem.

To install razor, you have to first install the razor-agents-sdk, and then the razor-agents. I'm pretty sure the first email in my logs that triggered the problem I'm about to describe happened after I installed razor-agents-sdk, but before I installed or configured razor-agents. Both those tools are installed with a perl makefile, so they are installing perl libraries and routines.

The Problem

After installing dcc and razor, spamassassin --lint (the command you run to check that spamassassin is configured without any problems) returned an error

Subroutine File::Spec::Unix::canonpath redefined at /usr/share/perl5/XSLoader.pm line 111.
Subroutine File::Spec::Unix::catdir redefined at /usr/share/perl5/XSLoader.pm line 111.
Subroutine File::Spec::Unix::catfile redefined at /usr/share/perl5/XSLoader.pm line 111.

That same error was appearing in /var/log/procmail.log every time an incoming email was being processed.

It was only a warning, but was clogging up log files so I wanted to fix it.

The Solution

Here's how I solved it (not just what I finally did). If your problem is similar, but not exactly the same, maybe these debugging steps will help you find what you need to do.

I kind of worked out that the File::Spec library was installed twice, and so was occuring twice in the perl path, and set out trying to see if that was indeed the case.

  • Find the perl path where perl will look for modules: perl -e "print qq(@INC)"
  • The result was

/usr/local/lib64/perl5/5.32 /usr/local/share/perl5/5.32 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5

  • I then looked through each of those directories in turn. A number had a File directory (namespace).
  • 2 of them had a file in that File folder named Spec.pm, with a subfolder named Spec.
  • So, routines like File::Spec::Unix::canonpath were being defined twice.
    • The timestamp on Spec.pm in /usr/local/lib64/perl5/5.32/File/ was Sep 1 2004. It had version ($VERSION = '0.90';).
    • The timestamp in /usr/lib64/perl5/vendor_perl/File was Feb 11 2022 and had version 3.78 (our $VERSION = '3.78';).
  • So I moved the older one out of the perl path.
  • spamassassin --lint was now fine.

Why the installer for razor (presumably) had installed a second copy of that library, I've no idea, and I don't frankly need to find out. The razor agent has not had a commit for a very long time, so it's not actively maintained, and there will be environment changes that the author couldn't have foreseen.

The important thing for my purposes was that I'd found the duplicate declaration, and removed one of them. No more messages in the logs.

Blog Category: 

Add new comment

Additional Terms