πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #79122

Re: Problem with perl scripts "bin/controlchan" and "bin/perl-nocem"

#79122
From: D. Stussy
Date: Thu, 12 Jun 2008 09:15
170 lines
7374 bytes
Conclusion:  Perl module Sys::Syslog 0.25 introduces a problem not present
in 0.24.  Please verify.

"Julien Γ‰LIE" <iulius@nom-de-mon-site.com.invalid> wrote in message
news:g2qfa9$3dp$1@news.trigofacile.com...
> > Jun 11 19:38:51 (none) innd: nocem! exit 2 elapsed 0 pid 5881
> > Jun 11 19:38:51 (none) innd: control! exit 2 elapsed 0 pid 5883
> > Jun 11 19:38:52 (none) innd: control! exit 2 elapsed 1 pid 5886
> > Jun 11 19:38:52 (none) innd: nocem! exit 2 elapsed 1 pid 5885
> > Jun 11 19:38:52 (none) innd: control! exit 2 elapsed 0 pid 5889
> > Jun 11 19:38:52 (none) innd: nocem! exit 2 elapsed 0 pid 5890
> >
> > I note that neither script actually has an "exit 2;" statement in them.
>
> pgpverify does:
>     exit(2) == The control message had an unknown PGP signature.
>
> Did you receive some articles for NoCeM or controlchan at 19:38:xx?

I don't think that's the problem.  The log messages are not on account of
receipt of a message (as far as I can tell) but continuous - as if the
scripts are aborting upon initialization - about 3 times per second ALL DAY.

> Maybe you can try to change the "2" in pgpverify to check whether
> it comes from it?
> It would be strange, though.
>
>       } elsif (/\[GNUPG:\]\s+NO_PUBKEY/) {
> -->      $ok = 2;
>
> > However, they can exit with an RC of either 0 or 1.
>
> Or 126 for perl-nocem.
>
> > I suspect that there is
> > some incompatibility with Perl 5.10.0 and an upgraded module in the past
> > week since I noticed this only this week and I upgrade modules via a
> > cron-job on Sundays.  No other perl script (including cleanfeed) seems
> > affected.
>
> Do you have the list of upgraded modules?
> Did the problem start the same day? (Sunday or Monday)

I noted another log entry-set (actually discovered in today's "daily usage
report' email; don't know which log file had it):

syslog: invalid level/facility: notice at /var/lib/news/bin/controlchan line
347
syslog: invalid level/facility: notice at /var/lib/news/bin/perl-nocem line
467

Now, Sys::Syslog was a perl module that was updated recently (and for me, on
Sunday).

Module id = Sys::Syslog
    CPAN_VERSION 0.25
    CPAN_FILE    S/SA/SAPER/Sys-Syslog-0.25.tar.gz
    UPLOAD_DATE  2008-06-05
(other info deleted).

This seems more likely the candidate error, especially since I just forced a
re-install of the module and got some obvious errors.  Here's one of them:

t/syslog.t.............3/215
#   Failed test 'syslog() called with level 'info''
#   at t/syslog.t line 107.
#          got: 'syslog: invalid level/facility: info at t/syslog.t line 106
# '
#     expected: ''

#   Failed test 'syslog() should return true: '0''
#   at t/syslog.t line 108.

Obviously, there's some problem with the log level names, and that would
cause the aborts I'm seeing.  "info", "notice", "local0", and "local1" tests
are failing - and "notice" is the level specified at the line numbers above
for the scripts.

Stepping back to version 0.24 of Sys::Syslog:
 - Successful compile and tests PASS.
 - INN scripts do RUN and not abort.
Problem fixed - for the moment....

Therefore, it appears (at least on my system) that Sys::Syslog v0.25
introduces an incompatibility, as compared to version 0.24.  Can someone
verify this?  7 changes are listed between these versions.  I think this is
the change that screws things up:

diff -ur Sys-Syslog-0.24-ZCmEPX/Syslog.pm Sys-Syslog-0.25-SpvqjY/Syslog.pm
--- Sys-Syslog-0.24-ZCmEPX/Syslog.pm     2007-12-31 16:15:28.000000000 +0000
+++ Sys-Syslog-0.25-SpvqjY/Syslog.pm     2008-05-18 19:54:49.000000000 +0000
...
@@ -293,25 +314,29 @@
     croak "syslog: expecting argument \$priority" unless defined $priority;
     croak "syslog: expecting argument \$format"   unless defined $mask;

+    croak "syslog: invalid level/facility: $priority" if $priority =~
/^-\d+$/;
     @words = split(/\W+/, $priority, 2);    # Allow "level" or
"level|facility".
     undef $numpri;
     undef $numfac;

-    foreach (@words) {
-       $num = xlate($_);                   # Translate word to number.
-       if ($num < 0) {
-           croak "syslog: invalid level/facility: $_"
-       }
-       elsif ($num <= &LOG_PRIMASK) {
-           croak "syslog: too many levels given: $_" if defined $numpri;
-           $numpri = $num;
-           return 0 unless LOG_MASK($numpri) & $maskpri;
-       }
-       else {
-           croak "syslog: too many facilities given: $_" if defined
$numfac;
-           $facility = $_;
-           $numfac = $num;
-       }
+    for my $word (@words) {
+        next if length $word == 0;
+
+        $num = xlate($word);        # Translate word to number.
+
+        if ($num < 0) {
+            croak "syslog: invalid level/facility: $word"
+        }
+        elsif ($num <= &LOG_PRIMASK) {
+            croak "syslog: too many levels given: $word" if defined
$numpri;
+            $numpri = $num;
+            return 0 unless LOG_MASK($numpri) & $maskpri;
+        }
+        else {
+            croak "syslog: too many facilities given: $word" if defined
$numfac;
+            $facility = $word;
+            $numfac = $num;
+        }
     }

     croak "syslog: level must be given" unless defined $numpri;
@@ -464,14 +489,14 @@
 # private function to translate names to numeric values
 #
 sub xlate {
-    my($name) = @_;
+    my ($name) = @_;
+
     return $name+0 if $name =~ /^\s*\d+\s*$/;
     $name = uc $name;
     $name = "LOG_$name" unless $name =~ /^LOG_/;
-    $name = "Sys::Syslog::$name";
-    # Can't have just eval { &$name } || -1 because some LOG_XXX may be
zero.
-    my $value = eval { no strict 'refs'; &$name };
-    $@ = "";
+    my $value = constant($name);
+    $value = -1 if $value =~ /not a valid/;
+
     return defined $value ? $value : -1;
 }


---------------
Obviously, for the error message to generate, "notice" isn't in @words or
isn't translated properly by xlate() - perhaps "notice" is assigned a value
of zero?  However, it looks as if its value should be either 5 or 10.

Technical Details
Message-ID: <g2qpjm$4p4$1@snarked.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!news-xfer.nntp.sonic.net!news.snarked.org!not-for-mail
References: <g2q778$62g$1@snarked.org> <g2qfa9$3dp$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <g2qpjm$4p4$1@snarked.org>
Subject: Re: Problem with perl scripts "bin/controlchan" and "bin/perl-nocem"
Date: Thu, 12 Jun 2008 02:15:22 -0700
From: "D. Stussy" <spam@bde-arc.ampr.org>
References: <g2q778$62g$1@snarked.org> <g2qfa9$3dp$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20141118.mbox.gz!number1.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!news-xfer.nntp.sonic.net!news.snarked.org!not-for-mail
Newsgroups: news.software.nntp
Lines: 170
Reply-To: "D. Stussy" <replies@newsgroups.kd6lvw.ampr.org>
NNTP-Posting-Host: pool-71-118-49-180.lsanca.dsl-w.verizon.net
X-Trace: snarked.org 1213262262 4900 71.118.49.180 (12 Jun 2008 09:17:42 GMT)
X-Complaints-To: newsmaster@snarked.org
NNTP-Posting-Date: Thu, 12 Jun 2008 09:17:42 +0000 (UTC)
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1478
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478