You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@spamassassin.apache.org on 2022/07/30 22:55:37 UTC

[Bug 8020] New: Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

            Bug ID: 8020
           Summary: Too many dependencies in
                    Mail::SpamAssassin:Util::DependencyInfo.pm
           Product: Spamassassin
           Version: 4.0.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Building & Packaging
          Assignee: dev@spamassassin.apache.org
          Reporter: sidney@sidney.com
  Target Milestone: Undefined

Mail::SpamAssassin:Util::DependencyInfo::try_binary() calls
Mail::SpamAssassin::Util::find_executable_in_env_path()

The problem is that Mail::SpamAssassin::Util requires non-core modules, for
example NetAddr::IP. If that module is not installed when Makefile.PL calls
Mail::SpamAssassin::Util::DependencyInfo::long_diagnostics() then instead of
printing diagnostics and returning a value indicating the missing module, the
function fails the use NetAddr::IP and dies.

This breaks CPAN testing on test machines that do not have NetAddr::IP
pre-installed because instead of discovering that NetAddr::IP is a dependency,
installing it, and continuing, the test fails early. That is not a common
configuration for the test machines, but I am seeing some.

I'm conflicted about the best way to fix this, considering that the functions
in Util form a public API that could be in use by third parties, so maybe
should not be simply changed. Otherwise, we could move long_diagnostics() and
the various functions it depends on to a new module, resulting in an API
change.

Alternatively, we can move long_diagnostics() and the functions it calls into a
new module but leave functions of the same name in Util that call them, to
preserve the API.

A third alternative is to replace the use NetAddr::IP and any other use of a
non-core module with something that does eval of require and so doesn't die
when a function that doesn't need the missing module is called.

Comments or suggestions?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8020] Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

--- Comment #3 from Sidney Markowitz <si...@sidney.com> ---
It's even simpler. reverse_ip_address only makes use of NetAddr::IP when it is
passed an ipv6 address, and if it doesn't have a recent enough version of
NetAddr::IP it outputs a message to that effect and returns. Everything will
work fine if we have

  use constant HAS_NETADDR_IP => eval { require NetAddr::IP; };

and include HAS_NETADDR_IP in the existing test in reverse_ip_address

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8020] Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

--- Comment #1 from Sidney Markowitz <si...@sidney.com> ---
I just noticed this in the perldoc description of Util

> NOTE: The functions in this module are to be considered private.  Their API
> may change at any point, and it's expected that they'll only be used by other
> Mail::SpamAssassin modules. (TODO: we should probably revisit this if
> it's useful for plugin development.)                                                                                                                      

Also, the only non-core module used in Util is NetAddr::IP and it is only
referenced in the sub reverse_ip_address. If we are going to move a function to
another module or make the failed dependency non-fatal, perhaps we should only
change something about that one function?

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8020] Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sidney@sidney.com
   Target Milestone|Undefined                   |4.0.0

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8020] Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

Sidney Markowitz <si...@sidney.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Sidney Markowitz <si...@sidney.com> ---
trunk % svn ci -m "bug 8020 - Make failed NetAddr::IP dependency not fatal when
checking dependencies" lib/Mail/SpamAssassin/Util.pm  
Sending        lib/Mail/SpamAssassin/Util.pm
Transmitting file data .done
Committing transaction...
Committed revision 1903131.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 8020] Too many dependencies in Mail::SpamAssassin:Util::DependencyInfo.pm

Posted by bu...@spamassassin.apache.org.
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8020

--- Comment #2 from Sidney Markowitz <si...@sidney.com> ---
Perl experts: Does it work to simply replace

use NetAddr::IP 4.000;

with

BEGIN { eval {require NetAddr::IP} }

The version check is not needed because reverse_ip_address already has a test
for the relevant function existing with a die if it doesn't.

-- 
You are receiving this mail because:
You are the assignee for the bug.