bugGNU TeXmacs - Bugs: bug #37638, PostScript import issue


You are not allowed to post comments on this tracker with your current authentication level.

bug #37638: PostScript import issue

Submitted by:  Albert Graef <agraef>
Submitted on:  Sat 27 Oct 2012 10:38:14 AM UTC  
Category:  Conversion Priority:  5 - Normal
Item Group:  Error Status:  Fixed
Privacy:  Public Assigned to:  Massimiliano Gubinelli <mgubi>
Originator Name:  Open/Closed:  Closed
Release:  r5795 Release:  None
Fixed Release:  None Fixed Release: 

( Jump to the original submission)

Thu 07 Apr 2016 10:30:35 PM UTC, comment #6:

no more problem in r 10099 with Ghostscript files such as golfer.eps (and gs 9.05)

Philippe Joyez <pjoyez>
Project Member
Wed 31 Oct 2012 08:53:41 AM UTC, comment #5:

After investigating some more, I think that the floating point exception message actually comes from ghostscript, not texmacs. I get exactly the same message with the pstopnm program:

$ pstopnm psbug.ps
Floating point exception

So this might just be an issue with postscript import after all. Unfortunately, poor Gimp doesn't let me create a 0x0 png image, so I can't test whether that might cause issues as well. ;-)

Albert Graef <agraef>
Wed 31 Oct 2012 08:39:38 AM UTC, comment #4:

I should mention that the suggested patch (file #26861) only fixes the problem for postscript import, of course. It is quite possible that the same kind of havoc might still happen with other image types if the image has zero height, I haven't tested that yet.

Apparently texmacs tries to calculate h_wd/h_pt somewhere (sloppy coding?), which gives the floating point exception. As this would normally yield a nan floating point value with IEEE754 floats in C/C++, maybe the issue is actually in Scheme/Guile code? Anyway, as I said, the root cause is most likely somewhere else.

Albert Graef <agraef>
Wed 31 Oct 2012 08:28:40 AM UTC, comment #3:

Fixed a minor glitch in the suggested patch, attached.

(file #26861)

Albert Graef <agraef>
Wed 31 Oct 2012 08:24:52 AM UTC, comment #2:

The attached minimal postscript file with an empty bounding box reproduces the problem (as verified this morning using the latest from trunk).

I think that just setting h_pt to 1 should always be ok, since the picture is then still empty and will correctly be displayed as such in texmacs once this second part of the issue is fixed.

Actually, you need to do that change in two places (at least), as indicated by the attached patch against the latest revision.

(file #26859, file #26860)

Albert Graef <agraef>
Sun 28 Oct 2012 02:37:25 PM UTC, comment #1:

I committed the patch (r5796) but I didn't commited the modification to avoid image height = 0. Could you provide me a way to trigger the Floating point exception so that I can fix this in the right way? I cannot reproduce this part of the problem.

Massimiliano Gubinelli <mgubi>
Project AdministratorIn charge of this item.
Sat 27 Oct 2012 10:38:14 AM UTC, original submission:

When trying to insert a PostScript image, I get the following message, then texmacs exists with an exit code of 136:

TeXmacs Cannot read image file '/home/ag/Desktop/texmacs-test/golfer.eps' in gs_image_size
Floating point exception

This can be reproduced with all but two of the sample PostScript files from the ghostscript package. It's a glaring bug in the gs_image_size_sub() routine in gs_utilities.cpp. Because of the bug, the bounding box isn't found, image width and height get both set to zero which then subsequently causes the floating point exception (maybe division by zero?). The attached patch fixes both issues.

(I'm running this on Linux, Ubuntu 11.04, x86_64.)

Can anyone please commit the patch? Note: The zero division issue probably requires further investigation, the patch only works around this by setting the default h_pt value to 1 instead of 0.


Albert Graef <agraef>


Attached Files
file #26861:  psbug.patch added by agraef (679B - text/x-patch)
file #26859:  psbug.ps added by agraef (43B - application/postscript)
file #26860:  psbug.patch added by agraef (668B - text/x-patch)
file #26834:  postscript-import.patch added by agraef (913B - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by pjoyez (Posted a comment)
  • -email is unavailable- added by mgubi (Posted a comment)
  • -email is unavailable- added by agraef (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-04-07 pjoyez StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2012-10-31 agraef Attached File- => Added psbug.patch, #26861
    2012-10-31 agraef Attached File- => Added psbug.ps, #26859
        Attached File- => Added psbug.patch, #26860
    2012-10-28 mgubi StatusNone => In Progress
        Assigned toNone => mgubi
        Releasecurrent svn => r5795
    2012-10-27 agraef Attached File- => Added postscript-import.patch, #26834

    Back to the top

    Powered by Savane 3.3