[Mimedefang] Overcoming RPM stupidity

Jeff Rife mimedefang at nabs.net
Tue Dec 19 08:24:37 EST 2006


On 19 Dec 2006 at 10:18, Jan-Pieter Cornet wrote:

> On Mon, Dec 18, 2006 at 09:28:51PM -0500, David F. Skoll wrote:
> > Hmmm....  I'm sure I had a reason for using the Syslog modules the way I
> > did instead of detecting them at runtime, but I can't remember what it
> > is.  I'll look into making mimedefang.pl detect the right syslog module
> > at runtime, which should make this a non-issue.
> 
> Probably because you're calling syslog (-related) functions before
> loading the user supplied mimedefang-filter, and doing detect_and_load_
> perl_modules()
> 
> However, from my cursory inspection, that only happens in case of
> an error...

But, it doesn't *really* work as you'd expect.

If the "$Features{'Unix::Syslog'}" is set correctly by ./configure, 
then md_openlog calls Unix::Syslog::openlog.

But, if "$Features{'Sys::Syslog'}" is set correctly by ./configure, it 
makes no difference whether "$Features{'Unix::Syslog'}" is set or 
not...md_openlog calls Sys::Syslog::openlog, because that is the only 
global function named "openlog" that is visible at that time (since 
Unix::Syslog hasn't been use'd).

If the filter then adds the extra lines to make Unix::Syslog truly 
available, then you get a clash because two globals with the same name 
are found.

I don't know perl well enough, but I didn't think the following would 
work:

if ($Features{'Unix::Syslog'}) {
  use Unix::Syslog qw(:macros :subs); $Features{"Unix::Syslog"} = 1;
  }
else {
  use Sys::Syslog qw(:DEFAULT setlogsock); $Features{"Unix::Syslog"} = 0;
  }

Is this the place for "eval"?


--
Jeff Rife |  
          | http://www.nabs.net/Cartoons/FoxTrot/GutterBall.gif 





More information about the MIMEDefang mailing list