After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 424017 - Don't cut errors at 80 characters (or give the column position of the error)
Don't cut errors at 80 characters (or give the column position of the error)
Status: RESOLVED NOTABUG
Product: libxml2
Classification: Platform
Component: general
2.6.16
Other All
: Normal minor
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-03-29 06:03 UTC by olivier Thereaux
Modified: 2007-04-04 04:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description olivier Thereaux 2007-03-29 06:03:19 UTC
libxml2 (and a lot of tools based on it) are handicapped by this part of error.c
    /* search backwards for beginning-of-line maximum 80 characters */
as a result, the exact context of the error is hard to find.

e.g in 
:294: parser error : EntityRef: expecting ';'
title="http://www.nytimes.com/2007/03/28/arts/music/28band.html?ex=1332734400&en
                                                                               ^
there is no way to know exactly where in line 294 the error was pointed.

The behavior assumes that the application is running in a 80-characters terminal, which seems rather silly, and given the widespread usage of libxml, wrong.

Suggested fixes:
* an option to output the column number along with the line number
(I don't think libxml2 has that, at least the perl binding XML::LibXML doesn't)
* or do NOT cut at 80 characters (or only if an environment variable shows there is a 80 chars term... )

Thanks, keep up the good work.

Other information:
Comment 1 olivier Thereaux 2007-03-29 12:46:03 UTC
(In reply to comment #0)
> The behavior assumes that the application is running in a 80-characters
> terminal, which seems rather silly, and given the widespread usage of libxml,
> wrong.

This was a very bad way to word this, my apologies. The point I was trying to make is, it's probably not the work of a library to worry about formatting of output. It should, rather, be the work of applications using the lib to trim the output depending on the type of device/UI used. 
Comment 2 Daniel Veillard 2007-03-29 12:50:56 UTC
Then use the structured error handler, you will get the same set of
input data as the default handler and do things the way you like them.
Suggested readings are:
   http://xmlsoft.org/html/libxml-xmlerror.html#xmlSetStructuredErrorFunc
   http://xmlsoft.org/html/libxml-xmlerror.html#xmlError
   xmlReportError() in error.c since you already started looking there

IMHO the API allows to do what you want already,

Daniel
Comment 3 olivier Thereaux 2007-04-04 04:33:36 UTC
Daniel,

(In reply to comment #2)
> Then use the structured error handler, you will get the same set of
> input data as the default handler and do things the way you like them.
> Suggested readings are:
>    http://xmlsoft.org/html/libxml-xmlerror.html#xmlSetStructuredErrorFunc
>    http://xmlsoft.org/html/libxml-xmlerror.html#xmlError
>    xmlReportError() in error.c since you already started looking there

Thanks for the pointers, you're right, the API allows for more flexible error reporting than I first thought. I'll take the suggestion to the XML::LibXML perl folks.

Merci.