Re: [Mon-devel] mon-client warning and escaping data problems
Brought to you by:
trockij
From: Ed R. <er...@pa...> - 2005-02-17 20:30:27
|
On Thu, Feb 17, 2005 at 02:14:11PM -0500, David Nolan wrote: > > > --On Thursday, February 17, 2005 1:35 PM -0500 Ed Ravin <er...@pa...> > wrote: > > > webserver: connection20refused > > > >Also, the failure details are listed in mon.cgi as "0a" when there are no > >details rather than the usual "<Not Specified>". > > > >Furthermore - ack doesn't work in mon.cgi. The CGI responds that the > >service was ACK'd successfully, but further inspection shows that it > >wasn't. > > > >The display problems go away when I stop using mod_perl (argh!) for > >mon.cgi. But ACK is still broken. > > > > > This sounds like you've got two versions of Mon::Client installed, the old > one and the new one. The newer code escapes space characters, and it > sounds like your client isn't unescaping them. That's exactly what was happening. I've removed the old version of Mon::Client and restarted Apache. I don't have the "20" problem anymore, but I'm still getting the warnings about un_esc_str() in Mon::Client. And the "ACK" command is still misbehaving, but I can see the problem is limited to my old mon.cgi - apparently the 'ack' field, instead of just being a 1 if the watch was ack'd, is now the ctime of the ack. So that leaves me with the warning in Mon::Client. I've figured that out too: I only get it when the service description is null AND the Perl program calling Mon::Client uses the "-w" option. This is a bug. Here is a possible fix: --- /usr/local/lib/site_perl/Mon/Client.pm 2004-06-18 10:25:16.000000000 -0400 +++ /new-version-of/Client.pm 2005-02-17 15:27:29.000000000 -0500 @@ -1673,6 +1673,8 @@ sub _un_esc_str { my $str = shift; + return "" unless defined($str); + $str =~ s{\\([0-9a-f]{2})}{chr(hex($1))}eg; $str; |