validator/httpd/cgi-bin check,1.511,1.512

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv18129/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Workaround and diagnostics for http://bugzilla.gnome.org/show_bug.cgi?id=434196

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.511
retrieving revision 1.512
diff -u -d -r1.511 -r1.512
--- check	28 Apr 2007 19:21:35 -0000	1.511
+++ check	28 Apr 2007 19:50:15 -0000	1.512
@@ -649,13 +649,22 @@
       elsif ($msg_line =~ /(\s+)\^/) {
         $xmlwf_error_col = length($1);
       }
-      if (defined($xmlwf_error_col) && $xmlwf_error_col == 79){
-        # working around an apparent odd limitation of libxml
-        # which only gives context for lines up to 80 chars
-        # http://www.w3.org/Bugs/Public/show_bug.cgi?id=4420
-        # http://bugzilla.gnome.org/show_bug.cgi?id=424017
-        $xmlwf_error_col = "> 80";
-        # non-int line number will trigger the proper behavior in report_error
+      if (defined($xmlwf_error_col)) {
+        if ((my $l = length($File->{Content}->[$xmlwf_error_line-1])) < $xmlwf_error_col) {
+          # http://bugzilla.gnome.org/show_bug.cgi?id=434196
+          warn("Warning: reported error column larger than line length " .
+               "($xmlwf_error_col > $l) in $File->{URI} line " .
+               "$xmlwf_error_line, libxml2 bug? Resetting to line length.");
+          $xmlwf_error_col = $l;
+        }
+        elsif ($xmlwf_error_col == 79) {
+          # working around an apparent odd limitation of libxml
+          # which only gives context for lines up to 80 chars
+          # http://www.w3.org/Bugs/Public/show_bug.cgi?id=4420
+          # http://bugzilla.gnome.org/show_bug.cgi?id=424017
+          $xmlwf_error_col = "> 80";
+          # non-int line number will trigger the proper behavior in report_error
+        }
       }
 
       if ((defined $xmlwf_error_line) and (defined $xmlwf_error_col) and (defined $xmlwf_error_msg)){

Received on Saturday, 28 April 2007 22:00:36 UTC