Bug 18826 - Cannot render any .ps or .eps
Summary: Cannot render any .ps or .eps
Status: RESOLVED MOVED
Alias: None
Product: libspectre
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: PowerPC Mac OS X (All)
: medium blocker
Assignee: Carlos Garcia Campos
QA Contact: Carlos Garcia Campos
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-30 18:04 UTC by Daniel Macks
Modified: 2018-10-12 21:37 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Daniel Macks 2008-11-30 18:04:08 UTC
Platform: OS X 10.4/ppc XCode-2.5

1. Compile and install libgs shared lib from ghostscript-8.63
2. Compile and install libspectre-0.2.2
3. Try to open various .ps and .eps files using test/parser-test
4. Try to open various .ps and .eps files using test/spectre-test
5. Compile evince-2.24.2 (all dependent libs at the level of GNOME2.24, supplied by fink)
6. Try to open various .ps and .eps files using evince

Files tried:

ghostscript's examples directory:
alphabet.ps  colorcir.ps  golfer.eps   snowflak.ps  waterfal.ps  
annots.pdf   doretree.ps  grayalph.ps  tiger.eps    
chess.ps     escher.ps    ridt91.eps   vasarely.ps  

xv's docs:
epsf.ps xpm.ps xvdocs.ps xvtitle.ps

All give same results:
In #3 no warnings or errors, and parsed off files named output.ps, prolog.txt, setup.txt, trailer.txt. I have no idea what they should contain though.

In #4, all fail the same way. For example, alphabet.ps:
>Testing libspectre version: 0.2.2
>process 21276: spectre_document_load: assertion `document != NULL' failed (spectre-document.c:57)
>Rendering document
>fatal internal error -100Error rendering document: render error
>Rendering document at 2x
>fatal internal error -100Error rendering document at 2x: render error
>fatal internal error -100Error exporting document as pdf: exporter error
>fatal internal error -100Error saving document as /tmp/foo/document-copy.pdf: >save error
>Document format: Unknown
>Postscript language level: 0
>Encapsulated PostScript: No
>Number of pages: 1
>Title: (null)
>Creator: (null)
>For: (null)
>Creation date: (null)
>Document Orientation: Portrait
>Page 0
>        Page label: (null)
>        Page size: 612 x 792
>        Page orientation: Portrait
>Error getting page 0 by its label (null): page is invalid
>fatal internal error -100Error rendering page 0: render error
>Rendering page 0 slice 204, 264, 204, 264
>fatal internal error -100Error rendering page slice 204, 264, 204, 264: render error
>Rendering page 0 in a4 page
>fatal internal error -100Error rendering page in a4 page: render error
>fatal internal error -100Error rendering page 0 at rotation 0: render error
>fatal internal error -100Error rendering page 1 at rotation 90: render error
>fatal internal error -100Error rendering page 2 at rotation 180: render error
>fatal internal error -100Error rendering page 3 at rotation 270: render error

Looking at spectre-test, first diagnostic is obvious (and intended?), given:
>spectre_document_load (NULL, argv[1]);
and the diagnostic occurs when parameter 1 is NULL. The rest, I have no idea, but a ton of render and export errors indicate something is very wrong here.

In #6, any file gives a bunch of:
>** (evince:15472): WARNING **: Error rendering thumbnail
>fatal internal error -100fatal internal error -100fatal internal error -100

and the file doesn't actually get beyond the "loading..." stage. Looks like the same problem (whatever it is) as spectre-test is having.

I know nothing about postscript, but could try to debug a little with some guidance for what/where to look.
Comment 1 Daniel Macks 2009-03-16 20:10:23 UTC
Alright this is ridiculous...4 months with a serious bug and not even a response of where to look or how to help solve it? I upgraded libgs to 8.64 and now spectre-test crashes outright with both .pdf and .ps that look fine in other viewers:

Testing libspectre version: 0.2.2
process 15493: spectre_document_load: assertion `document != NULL' failed (spectre-document.c:57)
Rendering document
Bus error

crash.log has:

PID:    15408
Thread: 0

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x0000000b

Thread 0 Crashed:
0   libspectre.1.dylib 	0x00031a9c spectre_presize + 28 (spectre-device.c:72)
1   libgs.8.64.dylib   	0x0117ba38 display_open + 296
2   libgs.8.64.dylib   	0x012eb8b8 gs_opendevice + 72
3   libgs.8.64.dylib   	0x01080fe0 display_set_callback + 240
4   libgs.8.64.dylib   	0x0107dcac gs_main_init2 + 428
5   libgs.8.64.dylib   	0x01080614 gs_main_init_with_args + 724
6   libspectre.1.dylib 	0x000310d4 spectre_gs_run + 20 (spectre-gs.c:190)
7   libspectre.1.dylib 	0x00031f4c spectre_device_render + 748 (spectre-device.c:255)
8   libspectre.1.dylib 	0x000325cc spectre_page_render + 220 (spectre-page.c:164)
9   libspectre.1.dylib 	0x0003084c spectre_document_render_full + 252 (spectre-document.c:338)
10  libspectre.1.dylib 	0x000308fc spectre_document_render + 124 (spectre-document.c:355)
11  spectre-test       	0x00002b5c main + 188 (spectre-test.c:219)
12  spectre-test       	0x000027dc _start + 760
13  spectre-test       	0x000024e0 start + 48

Comment 2 Carlos Garcia Campos 2009-03-17 06:38:58 UTC
(In reply to comment #1)
> Alright this is ridiculous...4 months with a serious bug and not even a
> response of where to look or how to help solve it?

I'm sorry, but I have been quite busy, I have this bug in my TODO list, so I haven't forgotten it. It's not easy to fix since it's not reproducible for me, and I don't have a Mac OSX to try with. 

> I upgraded libgs to 8.64 and
> now spectre-test crashes outright with both .pdf and .ps that look fine in
> other viewers:

spectre is not supposed to open PDF files, it should crash anyway, though.

> Testing libspectre version: 0.2.2
> process 15493: spectre_document_load: assertion `document != NULL' failed
> (spectre-document.c:57)
> Rendering document
> Bus error
> 
> crash.log has:
> 
> PID:    15408
> Thread: 0
> 
> Exception:  EXC_BAD_ACCESS (0x0001)
> Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x0000000b
> 
> Thread 0 Crashed:
> 0   libspectre.1.dylib  0x00031a9c spectre_presize + 28 (spectre-device.c:72)
> 1   libgs.8.64.dylib    0x0117ba38 display_open + 296
> 2   libgs.8.64.dylib    0x012eb8b8 gs_opendevice + 72
> 3   libgs.8.64.dylib    0x01080fe0 display_set_callback + 240
> 4   libgs.8.64.dylib    0x0107dcac gs_main_init2 + 428
> 5   libgs.8.64.dylib    0x01080614 gs_main_init_with_args + 724
> 6   libspectre.1.dylib  0x000310d4 spectre_gs_run + 20 (spectre-gs.c:190)
> 7   libspectre.1.dylib  0x00031f4c spectre_device_render + 748
> (spectre-device.c:255)
> 8   libspectre.1.dylib  0x000325cc spectre_page_render + 220
> (spectre-page.c:164)
> 9   libspectre.1.dylib  0x0003084c spectre_document_render_full + 252
> (spectre-document.c:338)
> 10  libspectre.1.dylib  0x000308fc spectre_document_render + 124
> (spectre-document.c:355)
> 11  spectre-test        0x00002b5c main + 188 (spectre-test.c:219)
> 12  spectre-test        0x000027dc _start + 760
> 13  spectre-test        0x000024e0 start + 48
> 

I'll look at it as soon as I find some time. 

Comment 3 Carlos Garcia Campos 2009-04-19 08:15:08 UTC
(In reply to comment #2)
> > I upgraded libgs to 8.64 and
> > now spectre-test crashes outright with both .pdf and .ps that look fine in
> > other viewers:
> 
> spectre is not supposed to open PDF files, it should crash anyway, though.

hmm, I meant it *shouldn't* crash anyway. 

> I'll look at it as soon as I find some time. 
> 

I'm sorry but I don't know what's the problem. Have you tried rendering ps documents directly with gs?
Comment 4 Daniel Macks 2009-04-25 12:52:50 UTC
'gs myfile.ps' renders fine, 'spectre-test myfile.ps' crashes. I tried applying the git patches after 0.2.2, didn't help. I'm on a powerpc machine...will ask my Intel-Mac friends to try it, rule in/out some endianness problem.
Comment 5 Antoine Jacoutot 2009-08-16 06:49:22 UTC
I'm having the exact same issue under OpenBSD-current (i386).

$ echo foobar > test  

$ a2ps test -o test.ps
[test (plain): 1 page on 1 sheet]
[Total: 1 page on 1 sheet] saved into the file `test.ps'

$ ./spectre-test test.ps
Testing libspectre version: 0.2.2
process 19062: spectre_document_load: assertion `document != NULL' failed (spectre-document.c:57)
Rendering document
fatal internal error -100Error rendering document: render error
Rendering document at 2x
fatal internal error -100Error rendering document at 2x: render error
GPL Ghostscript 8.63: **** Could not open the file (null)/output.pdf .
fatal internal error -100Error exporting document as pdf: exporter error
Error exporting document as ps: exporter error
Error saving document as (null)/document-copy.ps: save error
GPL Ghostscript 8.63: **** Could not open the file (null)/document-copy.pdf .
fatal internal error -100Error saving document as (null)/document-copy.pdf: save error
Document format: PS-Adobe-3.0
Postscript language level: 0
Encapsulated PostScript: No
Number of pages: 1
Title: test
Creator: a2ps version 4.14
For: Antoine Jacoutot
Creation date: Sun Aug 16 15:43:03 2009
Document Orientation: Landscape
Page 0
        Page label: 1
        Page size: 595 x 842
        Page orientation: Landscape
fatal internal error -100Error rendering page 0: render error
Rendering page 0 slice 198, 280, 198, 280
fatal internal error -100Error rendering page slice 198, 280, 198, 280: render error
Rendering page 0 in a4 page
fatal internal error -100Error rendering page in a4 page: render error
fatal internal error -100Error rendering page 0 at rotation 0: render error
fatal internal error -100Error rendering page 1 at rotation 90: render error
fatal internal error -100Error rendering page 2 at rotation 180: render error
fatal internal error -100Error rendering page 3 at rotation 270: render error


For info, "gs test.ps" works without issue.
Comment 6 Antoine Jacoutot 2009-08-21 13:02:15 UTC
(In reply to comment #5)

I forgot to mention that the error comes from:

success = spectre_gs_run (gs, n_args, args);
<...>
if (!success) {
     spectre_gs_free (gs);
    return SPECTRE_STATUS_RENDER_ERROR;
}

(line 255 of libspectre/spectre-device.c)


Note that it is a major issue since no PS file can be render on neither MacOS X nor OpenBSD :-(
Comment 7 Antoine Jacoutot 2009-09-10 00:25:13 UTC
So I guess running libspectre on something else than Linux on x86 is of no interest...
Comment 8 Carlos Garcia Campos 2009-09-10 01:38:52 UTC
I'm looking forward to seeing this bug fixed, but I don't have the hw/sw required to reproduce the issue.  Any help is greatly appreciated. 
Comment 9 Antoine Jacoutot 2009-09-11 03:08:42 UTC
(In reply to comment #8)
> I'm looking forward to seeing this bug fixed, but I don't have the hw/sw
> required to reproduce the issue.  Any help is greatly appreciated. 

Commit 077182e1fe53131d7c88cc1a0f278403e60bdc32 fixed my issue under OpenBSD, thank you very very much!

On a side note, I wonder if adding a check to make sure ghostcript was compiled with the "display" device wouldn't be nice... since I got trapped by this ;-)
Comment 10 Carlos Garcia Campos 2009-09-11 03:15:12 UTC
Daniel, could you check whether it is fixed for you too? if not, could you check your ghostscript is compiled with display device support?
Comment 11 Daniel Macks 2009-09-12 21:05:29 UTC
Applying that patch does not help: same crash (bus error with same trace) as in Comment #1.
Comment 12 Daniel Macks 2009-09-12 21:11:47 UTC
Oops, hit submit before finished responding:(

My libgs-8.64 is ./configured with --disable-gtk --disable-cups. I really don't know anything about gs...is there something I have to do to enable support for the "display" device, or some way I can check that it's actually built into my lib?
Comment 13 Antoine Jacoutot 2009-09-13 00:40:56 UTC
(In reply to comment #12)
> Oops, hit submit before finished responding:(
> 
> My libgs-8.64 is ./configured with --disable-gtk --disable-cups. I really don't
> know anything about gs...is there something I have to do to enable support for
> the "display" device, or some way I can check that it's actually built into my
> lib?

Yes, you need to configure with --enable-gtk

If you want to know which devices are compiled in, yo can run:
gs -?
Comment 14 Carlos Garcia Campos 2009-10-10 04:44:28 UTC
Daniel, is this still reproducible for you? did you check you have gs built with display device enabled?
Comment 15 Daniel Macks 2009-10-21 07:59:34 UTC
(Not sure where my response went.)  Even with --enable-gtk, I still get the same results. For some reason, display device is forced disabled (explicitly, without explanation in the configure scripts) on darwin regardless of any other settings. I have no idea why (there is no comment anywhere *why* building display support is disabled even if x11 is available). I tried patching to un-disable it and it still did not give a display device--I'll follow up with gs upstream. But for now, this makes spectre hopeless on darwin:( Will update if I learn anything further or it gets fixed.

Mean time, Comment #9 has an important idea: checking for this situation or at least not-crashing now that it's recognizeable failure mode. Best would be a runtime error message (since sys-admin could disable this feature in gs not realizing its importance) about gs not being able to be launched.
Comment 16 Daniel Macks 2012-10-28 04:43:47 UTC
libspectre-0.2.7's spectre-test and parser-test seem to work now on OS X 10.6 (intel; Apple discontinued powerpc hardware a few years ago). One major help was browsing the test/*.c sources to realize that the programs needed a second parameter--is a directory where intermediate and final output files go. Without that, there are lots of write errors and actions skipped, but no indication that it is a usage error rather than an actual testing problem. Would be useful if their main() checked that argv[2] is a writable directory.
Comment 17 GitLab Migration User 2018-10-12 21:37:30 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/libspectre/libspectre/issues/29.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.