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


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

bug #37638: PostScript import issue

Submitted by:  Albert Graef <agraef>
Submitted on:  Sat Oct 27 10:38:14 2012  
Category: ConversionPriority: 5 - Normal
Item Group: ErrorStatus: Fixed
Privacy: PublicAssigned to: Massimiliano Gubinelli <mgubi>
Originator Name: Open/Closed: Closed
Release: r5795Release: None
Fixed Release: NoneFixed Release: 

(Jump to the original submission Jump to the original submission)

Thu Apr 7 22:30:35 2016, 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 Oct 31 08:53:41 2012, 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 Oct 31 08:39:38 2012, 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 Oct 31 08:28:40 2012, comment #3:

Fixed a minor glitch in the suggested patch, attached.

(file #26861)

Albert Graef <agraef>
Wed Oct 31 08:24:52 2012, 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 Oct 28 14:37:25 2012, 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 Oct 27 10:38:14 2012, 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
  • -unavailable- added by pjoyez (Posted a comment)
  • -unavailable- added by mgubi (Posted a comment)
  • -unavailable- added by agraef (Submitted the item)

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

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Apr 7 22:30:35 2016pjoyezStatusIn Progress=>Fixed
    Wed Oct 31 08:28:40 2012agraefAttached File-=>Added psbug.patch, #26861
    Wed Oct 31 08:24:52 2012agraefAttached File-=>Added psbug.ps, #26859
      Attached File-=>Added psbug.patch, #26860
    Sun Oct 28 14:38:56 2012mgubiStatusNone=>In Progress
      Assigned toNone=>mgubi
      Releasecurrent svn=>r5795
    Sat Oct 27 10:38:14 2012agraefAttached File-=>Added postscript-import.patch, #26834

    Back to the top

    Powered by Savane 3.1-cleanup1