Davide Brini | 27 Jul 2011 16:55
Picon
Favicon

Syslog problems

Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1), and I
noticed that mon wasn't logging anything at all in syslog. Further
inspection revealed that the problem seems to be in the redefined syslog()
function:

no warnings; # Redefining syslog
sub syslog {
   eval {
       local $SIG{"__DIE__"}= sub { }; 
       my  <at> log = map { s/\%//mg; }  <at> _;
       Sys::Syslog::syslog( <at> log);
   }
}

since $_ is aliased in a map {} block, when the function is passed constant
strings, the map {} on  <at> _ fails with a "modification of a read-only value
attempted". However this is not apparent, not even in debug mode, since it
happens inside the eval{} block.

Suggested change (for example):

no warnings; # Redefining syslog
sub syslog {
   eval {
       local $SIG{"__DIE__"}= sub { };
       my  <at> log =  <at> _;
       s/\%//mg for ( <at> log);
       Sys::Syslog::syslog( <at> log);
   }
}
(Continue reading)

Allan Wind | 27 Jul 2011 19:38

Re: Syslog problems

On 2011-07-27 16:55:29, Davide Brini wrote:
> Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1), and I
> noticed that mon wasn't logging anything at all in syslog. Further
> inspection revealed that the problem seems to be in the redefined syslog()
> function:
> 
> no warnings; # Redefining syslog
> sub syslog {
>    eval {
>        local $SIG{"__DIE__"}= sub { }; 
>        my  <at> log = map { s/\%//mg; }  <at> _;
>        Sys::Syslog::syslog( <at> log);
>    }
> }
> 
> since $_ is aliased in a map {} block, when the function is passed constant
> strings, the map {} on  <at> _ fails with a "modification of a read-only value
> attempted". However this is not apparent, not even in debug mode, since it
> happens inside the eval{} block.
> 
> Suggested change (for example):
> 
> no warnings; # Redefining syslog
> sub syslog {
>    eval {
>        local $SIG{"__DIE__"}= sub { };
>        my  <at> log =  <at> _;
>        s/\%//mg for ( <at> log);
>        Sys::Syslog::syslog( <at> log);
>    }
(Continue reading)

Dario Minnucci | 27 Jul 2011 20:34
Picon
Favicon

Re: Syslog problems


Hi list,

On 07/27/2011 07:38 PM, Allan Wind wrote:
> On 2011-07-27 16:55:29, Davide Brini wrote:
>> Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1), and I
>> noticed that mon wasn't logging anything at all in syslog. Further
>> inspection revealed that the problem seems to be in the redefined syslog()
>> function:
>>
>> no warnings; # Redefining syslog
>> sub syslog {
>>    eval {
>>        local $SIG{"__DIE__"}= sub { }; 
>>        my  <at> log = map { s/\%//mg; }  <at> _;
>>        Sys::Syslog::syslog( <at> log);
>>    }
>> }
>>
>> since $_ is aliased in a map {} block, when the function is passed constant
>> strings, the map {} on  <at> _ fails with a "modification of a read-only value
>> attempted". However this is not apparent, not even in debug mode, since it
>> happens inside the eval{} block.
>>
>> Suggested change (for example):
>>
>> no warnings; # Redefining syslog
>> sub syslog {
>>    eval {
>>        local $SIG{"__DIE__"}= sub { };
(Continue reading)

Jim Trocki | 27 Jul 2011 21:35
Picon

Re: Syslog problems

On Wed, 27 Jul 2011, Allan Wind wrote:

>
> Debian fixed this with Bug#611751 I believe.  Surprised if that
> did not make it upstream.
>

It's in the CVS HEAD, has been for a while, which is newer than mon-1.2.0.
Time for a 1.2.1 I guess.
Dario Minnucci | 27 Jul 2011 20:37
Picon
Favicon

Re: Syslog problems


Hi Davide,

On 07/27/2011 04:55 PM, Davide Brini wrote:
> Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1), and I
> noticed that mon wasn't logging anything at all in syslog. Further
> inspection revealed that the problem seems to be in the redefined syslog()
> function:
> 

BTW, it was fixed under mon 1.2.0-2 as stated under Debian BTS #611751 [0]

So, consider update mon to 1.2.0-2

Regards,

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611751

--

-- 
 Dario Minnucci <midget <at> debian.org>
 Phone: +34 902884117 | Fax: +34 902024417 | Support: +34 807450000
 Key fingerprint = BAA1 7AAF B21D 6567 D457  D67D A82F BB83 F3D5 7033

_______________________________________________
mon mailing list
mon <at> linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon
(Continue reading)

Davide Brini | 28 Jul 2011 09:52
Picon
Favicon

Re: Syslog problems

On Wed, 27 Jul 2011 20:37:06 +0200, Dario Minnucci <midget <at> debian.org>
wrote:

> 
> Hi Davide,
> 
> On 07/27/2011 04:55 PM, Davide Brini wrote:
> > Hi, I'm using the stable mon-1.2.0-1 under Ubuntu 11.04 (Perl 5.10.1),
> > and I noticed that mon wasn't logging anything at all in syslog. Further
> > inspection revealed that the problem seems to be in the redefined
> > syslog() function:
> > 
> 
> 
> BTW, it was fixed under mon 1.2.0-2 as stated under Debian BTS #611751 [0]
> 
> So, consider update mon to 1.2.0-2

Well, apparently Ubuntu 11.04 doesn't have it (yet?).

http://packages.ubuntu.com/natty/mon

But I'm ok with my manual fix for now. I might open a bug in the Ubuntu
tracker. Thanks for all the answers.

--

-- 
D.

Gmane