Ticket #120 (new defect)

Opened 3 months ago

Last modified 2 weeks ago

Improve error reporting when non-number in numeric context

Reported by: DCameronMauch Assigned to:
Priority: minor Milestone: xmlroff 0.5.5
Component: libfo Version: 0.5.x
Keywords: Cc:
Blocking:

Description

compiled on hpux 11.11 with gcc 3.4.3 had to change compiler option "-mt" to "-pthread" after than it compiled with no errors whenever I specify the stylesheet, I get this error:

** ** libfo:ERROR:(fo-expr-eval.c:504):parse_number: code should not be reached ABORT instruction (core dumped)

there is nothing funky about the stylesheet name or location have core dump and compiled program I can send if desired here are the hpux depot dependencies I installed:

cairo-1.4.14-hppa-11.11.depot.gz fontconfig-2.5.0-hppa-11.11.depot.gz freetype-2.3.5-hppa-11.11.depot.gz glib2-2.16.2-hppa-11.11.depot.gz gtk+2-2.12.9-hppa-11.11.depot.gz libXrender-0.9.4-hppa-11.11.depot.gz libxslt-1.1.22-hppa-11.11.depot.gz pango-1.20.0-hppa-11.11.depot.gz renderproto-0.9.3-hppa-11.11.depot.gz

Attachments

master_sdrl.xsl (12.7 kB) - added by DCameronMauch on 04/15/08 19:01:48.
data.xml (1.0 kB) - added by DCameronMauch on 04/15/08 19:29:43.
120.fo (8.7 kB) - added by tkg on 04/15/08 20:15:13.
Result of transforming data.xml with master_sdrl.xsl.
master_sdrl_2.xsl (12.8 kB) - added by DCameronMauch on 04/15/08 20:50:39.
updated XSL file with "url()" stuff added
text.xml (8.7 kB) - added by DCameronMauch on 04/30/08 15:43:01.
latest requested file

Change History

04/15/08 17:07:33 changed by DCameronMauch

here's the command line example:

sdths03>/cvs/n1800002/epdm/sdt/xsl> xmlroff -o foo.pdf /tmp/xml-1208200476-263 master_sdrl.xsl ** ** libfo:ERROR:(fo-expr-eval.c:504):parse_number: code should not be reached ABORT instruction (core dumped)

04/15/08 18:14:45 changed by tkg

  • summary changed from dumps core immediately - doesn't like arguments? to Allow numbers with no digits after ".".

See source:trunk/xmlroff/libfo/expr/fo-expr-eval.c@136#L480

To reach line 504, your FO document (the result of the transform) has an expression that contains numbers followed by "." followed by something that isn't a number. I.e., it would match the regular expression "[0-9]+\.[0-9]".

xmlroff isn't coping, but the production at http://www.w3.org/TR/xsl11/#NT-FloatingPointNumber says it's okay to not have digits after the ".".

04/15/08 18:24:02 changed by tkg

  • summary changed from Allow numbers with no digits after "." to Improve error reporting when non-number in numeric context.

Looking at source:trunk/xmlroff/libfo/expr/fo-expr-eval.c@136#L480 again, the assertion was reached because you have a "." that was neither preceded nor followed by digits.

If the "." was preceded by digits, then 'ok' would be TRUE, and the assertion would not be reached.

It would still help if xmlroff did a better job of reporting the error instead of just falling over.

(follow-up: ↓ 5 ) 04/15/08 18:26:15 changed by DCameronMauch

I did find two lines with a O instead of a 0.

But it is still failing with the same error message. The only remaining lines which match that regex are these:

3 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 4 xmlns:fo="http://www.w3.org/1999/XSL/Format"> 8 <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">

Don't those lines have to be there?

(in reply to: ↑ 4 ) 04/15/08 18:51:55 changed by tkg

Replying to DCameronMauch:

I did find two lines with a O instead of a 0.

0 is not a problem. It's what comes after a "." that's causing the problem.

The best way to find out (short of implementing the fix) would be to fire up gdb on the core file and look at 'context'.

The next best way would be to run the transform outside xmlroff and search the result for:

["' ]\.[0-9]

If you could make a minimal FO file that breaks xmlroff and attach it to this ticket, I could look at it.

04/15/08 18:53:51 changed by tkg

Without the not so helpful wiki formatting, that regex would be:

["' ]\.[^0-9]

04/15/08 19:01:48 changed by DCameronMauch

  • attachment master_sdrl.xsl added.

04/15/08 19:03:46 changed by DCameronMauch

I wrote a perl program to search for that regex. Only finding those three name space definitions that match it. I may have a fundamental misunderstanding: Can I take the XML/XSL files which I have been processing with Apache FOP (too slow, memory footprint too big), and process them with XMLROFF? I attached the XSL file I have been testing with.

04/15/08 19:13:41 changed by tkg

You need to either also attach the XML file or run the stylesheet on the XML file using a XSLT processor such as Saxon or xsltproc and attach the output of that, since that's what xmlroff is objecting to.

You can run the same files through xmlroff as you run through FOP, but so far FOP supports more of the spec than does xmlroff.

(in reply to: ↑ description ) 04/15/08 19:25:48 changed by tkg

Replying to DCameronMauch:

compiled on hpux 11.11 with gcc 3.4.3 had to change compiler option "-mt" to "-pthread" after than it compiled with no errors

I'm not sure how to solve it since it probably requires some 'configure' fu, and I can't test any solution, but can you make a separate ticket for the HP-UX problem?

(follow-up: ↓ 16 ) 04/15/08 19:29:28 changed by DCameronMauch

Not really worried about the compiler option issue. I got past it.

04/15/08 19:29:43 changed by DCameronMauch

  • attachment data.xml added.

04/15/08 19:31:05 changed by DCameronMauch

Okay. I attached the XML file I have been using for testing. I don't see anything in this file matching that regex.

04/15/08 19:43:54 changed by tkg

The offending text is "./images/master_banner.jpg".

The 'src' attribute value should be "url(./images/master_banner.jpg)".

See http://www.w3.org/TR/xsl11/#src and the definition of <uri-specification> in http://www.w3.org/TR/xsl11/#datatype

04/15/08 20:06:46 changed by DCameronMauch

What does that have to do with the numberic regex thing? I added the "url()" part and fully specified the path. Now I am getting this error:

sdths03>/cvs/n1800002/epdm/sdt/xsl> xmlroff -o foo.pdf /tmp/xml-1208200476-263 master_sdrl.test
**
** libfo:ERROR:(fo-external-graphic.c:1369):resolve_one_dimension: code should not be reached
ABORT instruction (core dumped)

04/15/08 20:15:13 changed by tkg

  • attachment 120.fo added.

Result of transforming data.xml with master_sdrl.xsl.

04/15/08 20:50:39 changed by DCameronMauch

  • attachment master_sdrl_2.xsl added.

updated XSL file with "url()" stuff added

04/15/08 20:55:55 changed by tkg

(In [410]) Handling length-range for viewport width/height when resolving dimensions. Re #120.

04/15/08 20:58:14 changed by tkg

Replying to DCameronMauch:

What does that have to do with the numberic regex thing?

I have attached '120.fo' which is the result of transforming data.xml with master-sdrl.xsl. That has a 'src' attribute that matches that last regex.

When the attribute was:

src="../images/master_banner.jpg"

when the expression parser got to the first ".", the only "." allowed at that point was as part of a number, so the expression parser tried and failed to evaluate the attribute value as a number.

I added the "url()" part and fully specified the path. Now I am getting this error:

Adding the "url()" would have been sufficient.

{{{ sdths03>/cvs/n1800002/epdm/sdt/xsl> xmlroff -o foo.pdf /tmp/xml-1208200476-263 master_sdrl.test ** ** libfo:ERROR:(fo-external-graphic.c:1369):resolve_one_dimension: code should not be reached ABORT instruction (core dumped) }}}

That is a bug. That, at least, is fixed now, but unless your graphics are almost exactly the right size, you're going to run into #121.

(in reply to: ↑ 10 ) 04/18/08 07:40:48 changed by tkg

Replying to DCameronMauch:

Not really worried about the compiler option issue. I got past it.

I'm glad that you got past it, but the next person compiling on HP-UX might not get past it so easily. It would help them if it was documented as a problem with a workaround.

(follow-up: ↓ 18 ) 04/29/08 19:46:07 changed by DCameronMauch

Got sidetracked for a while. Put the patch in place and recompiled. I also prescaled the graphics with another tool, so I could remove all the size and scaling directive in the XSL file. Still getting this error:

(xmlroff:12455): GdkPixbuf-CRITICAL **: file gdk-pixbuf.c: line 503: assertion `pixbuf != NULL' failed

(in reply to: ↑ 17 ) 04/29/08 20:08:21 changed by tkg

Replying to DCameronMauch:

Got sidetracked for a while. Put the patch in place and recompiled. I also prescaled the graphics with another tool, so I could remove all the size and scaling directive in the XSL file. Still getting this error:

It's a different error from previously, which hopefully is a sign of progress.

Can you attach the FO that is failing (e.g., run your XML and stylesheet through xsltproc and attach the result)?

04/30/08 15:43:01 changed by DCameronMauch

  • attachment text.xml added.

latest requested file

04/30/08 15:43:39 changed by DCameronMauch

Okay. I attached the resulting output "text.xml" file.

05/01/08 20:32:29 changed by tkg

Did you also get this:

(xmlroff:12042): libfo-CRITICAL **: g-file-error-quark: Failed to open file '../images/master_banner.jpg': No such file or directory
Could not load image.

I only get the pixbuf != NULL assertion failures when xmlroff can't find the file. (And the verbosity of the failed assertions is #69.)

07/06/08 11:20:21 changed by tkg

Is this still a bug for you?