On Fri, Mar 05, 2004 at 11:34:16AM +0100,
 Stephane Bortzmeyer <[EMAIL PROTECTED]> wrote 
 a message of 26 lines which said:

> I use Mon::Client and mod_perl to serve information from mon on the
> Web. At the command line, everything is fine, but when running under
> mod_perl (either Mason or Apache::Registry), I experience the
> infamous "Segmentation fault" when calling things like
> list_opstatus.

David Nolan kindly sent a patch to mon which works fine: mon's default
parsing of replies apparently triggers a mod_perl bug. I suggest to
adopt this patch. It works now (you can see the result at
http://www.generic-nic.net/dyn/mon/: mon + mod_perl + Mason).

I quote his explanation: "Basically the whole change is to escape
spaces in the various strings passed over the wire, so that the
parsing of the protocol can be done by just spliting on spaces,
instead of using the buggy Text::Parsewords.  Space happends to be
ASCII 32."

--- Client.pm.orig      Thu Mar  8 03:51:35 2001
+++ Client.pm   Wed Mar 17 17:07:08 2004
@@ -1929,7 +1929,9 @@
     }
 
     foreach $o (@op) {
-       foreach my $w (quotewords ('\s+', 0, $o)) {
+        #print "**********", $o, "\n";
+       foreach my $w (split ('\s+', $o, 0)) {
+            #print $w, "\n";
            my ($var, $val) = split (/=/, $w, 2);
            $op{$var} = _un_esc_str ($val);
        }
@@ -2007,7 +2009,7 @@
     {
        my $c = substr ($str, $i, 1);
 
-       if (ord ($c) < 32 ||
+       if (ord ($c) <= 32 ||
            ord ($c) > 126 ||
            $c eq "\"" ||
            $c eq "\'")


--- mon.orig    Wed Mar 17 16:45:10 2004
+++ mon Wed Mar 17 16:49:50 2004
@@ -4880,7 +4880,7 @@
     {
        my $c = substr ($str, $i, 1);
 
-       if (ord ($c) < 32 ||
+       if (ord ($c) <= 32 ||
            ord ($c) > 126 ||
            $c eq "\"" ||
            $c eq "\'")

_______________________________________________
mon mailing list
[EMAIL PROTECTED]
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to