Bug 692309 - GS segfault on some PDF files when compiled with '--disable-compile-init'
Summary: GS segfault on some PDF files when compiled with '--disable-compile-init'
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: Graphics Library (show other bugs)
Version: master
Hardware: PC Linux
: P1 blocker
Assignee: Alex Cherepanov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-28 15:29 UTC by Vladimir Lomov
Modified: 2011-07-27 15:12 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments
Sample PS file (154.37 KB, application/postscript)
2011-06-28 15:29 UTC, Vladimir Lomov
Details
valgrind output (251.56 KB, text/plain)
2011-06-28 15:31 UTC, Vladimir Lomov
Details
strace output (227.80 KB, text/plain)
2011-06-28 15:31 UTC, Vladimir Lomov
Details
Output from 'gs --help' (3.51 KB, text/plain)
2011-06-29 01:35 UTC, Vladimir Lomov
Details
Output from 'gs --help' (3.56 KB, text/plain)
2011-06-29 01:36 UTC, Vladimir Lomov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Lomov 2011-06-28 15:29:34 UTC
Created attachment 7617 [details]
Sample PS file

Hi.

When GS is compiled from git repo (commit rev. 11fa4e84f504bdbd9e78495cf5214e49554383b0) with option '--disable-compile-init' (see build script here: https://raw.github.com/vp1981/pkgbuild/master/ghostscript/PKGBUILD, especially configure options) it segfaults on this PS file: logimage_.eps (its from asymptote documentation).

What was run in terminal:
[terminal]
gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[/terminal]

[output]
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/output]

Ошибка сегментирования -> Segfault (http://translate.google.com/#ru|en|%D0%9E%D1%88%D0%B8%D0%B1%D0%BA%D0%B0%20%D1%81%D0%B5%D0%B3%D0%BC%D0%B5%D0%BD%D1%82%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D1%8F).

If GS was compiled without '--disable-compile-init' then file is converted fine.

(Below output was get from gs compiled with '--disable-init-compile' and '--enable-debug')

VALGRIND run:
[terminal]
$ valgrind -v --show-reachable=yes --leak-check=full gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[/terminal]

STRACE run:
[terminal]
$ strace -F -v gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[/terminal]

GDB run:
[terminal]
$ gdb gs
[/terminal]

[output]
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gs...(no debugging symbols found)...done.
(gdb) run -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
Starting program: /usr/bin/gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[Thread debugging using libthread_db enabled]
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile

Program received signal SIGSEGV, Segmentation fault.
0x000000000055dc06 in ?? ()
(gdb) backtrace
#0  0x000000000055dc06 in ?? ()
#1  0x0000000000661e61 in ?? ()
#2  0x0000000000662156 in ?? ()
#3  0x0000000000662b0d in ?? ()
#4  0x00000000006631bc in psdf_setup_image_filters ()
#5  0x00000000006aa55b in ?? ()
#6  0x00000000006aabda in ?? ()
#7  0x00000000006ab50e in gdev_pdf_begin_typed_image ()
#8  0x0000000000793bad in gs_image_begin_typed ()
#9  0x00000000004fb85e in zimage_setup ()
#10 0x00000000004fbdf1 in image1_setup ()
#11 0x00000000004c9721 in ?? ()
#12 0x00000000004cae93 in gs_interpret ()
#13 0x00000000004bfe33 in gs_main_run_string_end ()
#14 0x00000000004c0b9b in ?? ()
#15 0x00000000004c0d01 in ?? ()
#16 0x00000000004c2b7f in gs_main_init_with_args ()
#17 0x0000000000457d24 in main ()
[/output]

P.S. May be this bug has the same source as http://bugs.ghostscript.com/show_bug.cgi?id=692251 but I not sure.
Comment 1 Vladimir Lomov 2011-06-28 15:31:07 UTC
Created attachment 7618 [details]
valgrind output

valgrind output caught from terminal
Comment 2 Vladimir Lomov 2011-06-28 15:31:41 UTC
Created attachment 7619 [details]
strace output

strace output caught from terminal
Comment 3 Ken Sharp 2011-06-28 16:20:25 UTC
If I specify -sGenericResoruceDir, or include the Resources in the search path by using -I, then this works fine for me using the current master.

Presumably you must have the resources in the search path somewhere ?
Comment 4 Ken Sharp 2011-06-28 16:22:28 UTC
Should have said the master Git commit at the moment is '11fa4e84f504bdbd9e78495cf5214e49554383b0'
Comment 5 Vladimir Lomov 2011-06-29 01:25:38 UTC
(In reply to comment #4)
> Should have said the master Git commit at the moment is
> '11fa4e84f504bdbd9e78495cf5214e49554383b0'

Ok, will do next time.
Comment 6 Vladimir Lomov 2011-06-29 01:32:56 UTC
(In reply to comment #3)
> If I specify -sGenericResoruceDir, or include the Resources in the search path
> by using -I, then this works fine for me using the current master.
> 
> Presumably you must have the resources in the search path somewhere ?

May be you mean '-sGenericResourceDir'? In any case this is what I have:

[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResoruceDir -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]

[terminal]
gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]

[terminal]
gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]

[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResourceDir -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
GenericResourceDir value does not end with directory separator.

While reading gs_res.ps:
Error: /configurationerror in GenericResourceDir
Operand stack:
   (gs_res.ps)   (x/y)   (/x/y)
Execution stack:
   %interp_exit   --nostringval--   --nostringval--   --nostringval--   %array_continue   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   --nostringval--
Dictionary stack:
   --dict:790/1123(G)--   --dict:70/200(L)--   --dict:790/1123(G)--   --dict:167/251(G)--
Current file position is 13210
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    gs_res.ps  x/y  /x/y
[/terminal]

Also, this I have on my system (master Git commit at the moment: 31cb1ff75d4a77ac32854a68f56d973d06b5da10):
[terminal]
$ LANG=C ls -lA /usr/share/ghostscript/9.03/
total 7
drwxr-xr-x 9 root root  224 Jun 29 09:06 Resource
drwxr-xr-x 2 root root 1424 Jun 29 09:11 doc
drwxr-xr-x 3 root root  480 Jun 29 09:11 examples
drwxr-xr-x 2 root root  320 Jun 29 09:11 iccprofiles
drwxr-xr-x 2 root root 5720 Jun 29 09:11 lib
[/terminal]

I attached output from 'gs --help' from 9.02 and git ver.
Comment 7 Vladimir Lomov 2011-06-29 01:35:29 UTC
Created attachment 7627 [details]
Output from 'gs --help'

This output was generated by gs from distro package, ver. 9.02
Comment 8 Vladimir Lomov 2011-06-29 01:36:49 UTC
Created attachment 7628 [details]
Output from 'gs --help'

This output was generated by gs compiled from git repo, master Git commit 31cb1ff75d4a77ac32854a68f56d973d06b5da10 at the moment
Comment 9 Ken Sharp 2011-06-29 07:05:16 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > Should have said the master Git commit at the moment is
> > '11fa4e84f504bdbd9e78495cf5214e49554383b0'
> 
> Ok, will do next time.

Actually I meant *I* should have mentioned the hash of the commit I was using ;-)

(In reply to comment #6)
> (In reply to comment #3)
> > If I specify -sGenericResoruceDir, or include the Resources in the search path
> > by using -I, then this works fine for me using the current master.
> > 
> > Presumably you must have the resources in the search path somewhere ?
> 
> May be you mean '-sGenericResourceDir'? In any case this is what I have:

Yes, I meant GenericResourceDir, that was a typo.
 
> [terminal]
> gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/ -sDEVICE=pdfwrite
> -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> sfopen: gs_parse_file_name failed.
> sfopen: gs_parse_file_name failed.
>   ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
> default_rgb.icc 
> | ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
> profile
> Ошибка сегментирования
> [/terminal]
> 
> [terminal]
> gs -q -dNOPAUSE -dBATCH -sGenericResourceDir -sDEVICE=pdfwrite -dEPSCrop
> -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> GenericResourceDir value does not end with directory separator.

You actually have to set GenericResourceDir to the location of the 'Resource' directory that GS is to use. Or, set -I to the same directory. 

GenericResourceDir is documented in gs/doc/Use.htm.

Setting it incorrectly is what leads to the following error:


> While reading gs_res.ps:
> Error: /configurationerror in GenericResourceDir
> Operand stack:
>    (gs_res.ps)   (x/y)   (/x/y)
> Execution stack:
>    %interp_exit   --nostringval--   --nostringval--   --nostringval--  
> %array_continue   --nostringval--   --nostringval--   --nostringval--   false  
> 1   %stopped_push   --nostringval--
> Dictionary stack:
>    --dict:790/1123(G)--   --dict:70/200(L)--   --dict:790/1123(G)--  
> --dict:167/251(G)--
> Current file position is 13210
> Unrecoverable error: undefined in .uninstallpagedevice
> Operand stack:
>     gs_res.ps  x/y  /x/y
> [/terminal]

 
> $ LANG=C ls -lA /usr/share/ghostscript/9.03/
> total 7
> drwxr-xr-x 9 root root  224 Jun 29 09:06 Resource
> drwxr-xr-x 2 root root 1424 Jun 29 09:11 doc
> drwxr-xr-x 3 root root  480 Jun 29 09:11 examples
> drwxr-xr-x 2 root root  320 Jun 29 09:11 iccprofiles
> drwxr-xr-x 2 root root 5720 Jun 29 09:11 lib
> [/terminal]
> 
> I attached output from 'gs --help' from 9.02 and git ver.

The search path shows that your system is currently set up to use the 89.02 resources and initialisation files, this could be the source of the problem.

Try setting 

-sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/

You do need the trailing forward slash.

Or

-I/usr/share/ghostscript/9.03/Resource

For me either of these works (with different paths obviously).
Comment 10 Vladimir Lomov 2011-06-29 09:22:27 UTC
(In reply to comment #9)
[...]
 
> > [terminal]
> > gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/ -sDEVICE=pdfwrite
> > -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> > -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> > -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> > -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> > sfopen: gs_parse_file_name failed.
> > sfopen: gs_parse_file_name failed.
> >   ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
> > default_rgb.icc 
> > | ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
> > profile
> > Ошибка сегментирования
> > [/terminal]
> > 
> > [terminal]
> > gs -q -dNOPAUSE -dBATCH -sGenericResourceDir -sDEVICE=pdfwrite -dEPSCrop
> > -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100
> > -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER
> > -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964
> > -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
> > GenericResourceDir value does not end with directory separator.
> 
> You actually have to set GenericResourceDir to the location of the 'Resource'
> directory that GS is to use. Or, set -I to the same directory. 
> 
> GenericResourceDir is documented in gs/doc/Use.htm.
> 
> Setting it incorrectly is what leads to the following error:
[...]
Understand
 
> > $ LANG=C ls -lA /usr/share/ghostscript/9.03/
> > total 7
> > drwxr-xr-x 9 root root  224 Jun 29 09:06 Resource
> > drwxr-xr-x 2 root root 1424 Jun 29 09:11 doc
> > drwxr-xr-x 3 root root  480 Jun 29 09:11 examples
> > drwxr-xr-x 2 root root  320 Jun 29 09:11 iccprofiles
> > drwxr-xr-x 2 root root 5720 Jun 29 09:11 lib
> > [/terminal]
> > 
> > I attached output from 'gs --help' from 9.02 and git ver.
> 
> The search path shows that your system is currently set up to use the 89.02
> resources and initialisation files, this could be the source of the problem.

I don't understand.
The ver. compiled from git repo has the same directory structure as 9.02 (I compare self compiled package and distro one): there is directory `/usr/share/ghostscript/VER' (VER=9.03 and 9.02 resp.) which has following subdirs:
Resources/
doc/
examples/
iccprofiles/
lib/
and this structure was created by `make install soinstall'.

> 
> Try setting 
> 
> -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/
> 
> You do need the trailing forward slash.
> 
> Or
> 
> -I/usr/share/ghostscript/9.03/Resource
> 

Here:
[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]

[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps

*** Warning: GenericResourceDir doesn't point to a valid resource directory.
               the -sGenericResourceDir=... optionsfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]
(I think this is expected result)

[terminal]
gs -q -dNOPAUSE -dBATCH -I/usr/share/ghostscript/9.03/Resource -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]

Run the same command under gdb:
[terminal]
gdb gs
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/gs...(no debugging symbols found)...done.
(gdb) run -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
Starting program: /usr/bin/gs -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
[Thread debugging using libthread_db enabled]
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile

Program received signal SIGSEGV, Segmentation fault.
0x000000000055d186 in ?? ()
(gdb) backtrace
#0  0x000000000055d186 in ?? ()
#1  0x0000000000660fc1 in ?? ()
#2  0x00000000006612b6 in ?? ()
#3  0x0000000000661c6d in ?? ()
#4  0x000000000066231c in psdf_setup_image_filters ()
#5  0x00000000006a96ab in ?? ()
#6  0x00000000006a9d2a in ?? ()
#7  0x00000000006aa65e in gdev_pdf_begin_typed_image ()
#8  0x000000000079271d in gs_image_begin_typed ()
#9  0x00000000004fae4e in zimage_setup ()
#10 0x00000000004fb3e1 in image1_setup ()
#11 0x00000000004c8eb1 in ?? ()
#12 0x00000000004ca623 in gs_interpret ()
#13 0x00000000004bf5c3 in gs_main_run_string_end ()
#14 0x00000000004c032b in ?? ()
#15 0x00000000004c0491 in ?? ()
#16 0x00000000004c230f in gs_main_init_with_args ()
#17 0x0000000000457bd4 in main ()
[/terminal]
(Seems the same output as w/o '-sGene...')

master Git commit '865dca5781dcb4fea12d1349d4f7392d7d809c42' at the moment.

> For me either of these works (with different paths obviously).

I'm lost...

P.S. Why this spurious message?
[quote]
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
[/quote]

Even if I add '-sICCProfilesDir' and run
[terminal]
gs -q -dNOPAUSE -dBATCH -sGenericResourceDir=/usr/share/ghostscript/9.03/Resource/ -sICCProfilesDir=/usr/share/ghostscript/9.03/iccprofiles/ -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
Ошибка сегментирования
[/terminal]
I get 'Could not find...' (w/o trailing slash I get more warnings).

Only if I manually copy default_rgb.icc and default_gray.icc to the current directory then I get
[terminal]
gs -q -dNOPAUSE -dBATCH -I. -sDEVICE=pdfwrite -dEPSCrop -dSubsetFonts=true -dEmbedAllFonts=true -dMaxSubsetPct=100 -dPDFSETTINGS=/prepress -dCompatibilityLevel=1.4 -P -dSAFER -dAutoRotatePages=/None -g612x792 -dDEVICEWIDTHPOINTS=284.964 -dDEVICEHEIGHTPOINTS=287.657 -sOutputFile=logimage.pdf logimage_.eps
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
[/terminal]
w/o segfault.
Comment 11 Ken Sharp 2011-06-29 12:02:39 UTC
(In reply to comment #10)

> > > I attached output from 'gs --help' from 9.02 and git ver.
> > 
> > The search path shows that your system is currently set up to use the 89.02
> > resources and initialisation files, this could be the source of the problem.
> 
> I don't understand.
> The ver. compiled from git repo has the same directory structure as 9.02 (I
> compare self compiled package and distro one): there is directory
> `/usr/share/ghostscript/VER' (VER=9.03 and 9.02 resp.) which has following
> subdirs:
> Resources/
> doc/
> examples/
> iccprofiles/
> lib/
> and this structure was created by `make install soinstall'.

Ah, you didn't label the two 'gs --help' attachments (or rather labelled them the same), and I read the wrong one, sorry about that. The one for 9.03 does appear to be as expected.

 
> I'm lost...
> 
> P.S. Why this spurious message?
> [quote]
>   ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find
> default_rgb.icc 
> | ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device
> profile
> [/quote]

Its not spurious I think, its telling you that it couldn't find a particular icc profile, and that (eventually) is what is leading to your segmentation fault.

What I don't understand is why your system can't find the iccprofiles directory. It seems to be present, correctly named and in a location which the search path ought to find, yet it persists in not finding it.

When I do the same here (on Fedora 14) it works, and even if I don't configure GS properly it doesn't seg fault, it just exists with an error.

The only thing I can think of is to check that you have cleaned and rebuilt 9.03 completely ? 

Failing that I'm going to have to leave this to one of the  developers with more Linux experience than me to try and reproduce.
Comment 12 Vladimir Lomov 2011-06-30 01:14:53 UTC
(In reply to comment #11)
[...]
> What I don't understand is why your system can't find the iccprofiles
> directory. It seems to be present, correctly named and in a location which the
> search path ought to find, yet it persists in not finding it.
> 
> When I do the same here (on Fedora 14) it works, and even if I don't configure
> GS properly it doesn't seg fault, it just exists with an error.
So, may be dirrefent gcc, bintuils? I'm using currently:
[terminal]
$ gcc --version
gcc (GCC) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[/terminal]

[terminal]
$ ld --version
GNU ld (GNU Binutils) 2.21.1.20110627
Copyright 2011 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
[/terminal]
 
> The only thing I can think of is to check that you have cleaned and rebuilt
> 9.03 completely ? 

I'll try to install several OS into VirtualBox and check, but only lately.
Comment 13 Vladimir Lomov 2011-06-30 01:16:53 UTC
(In reply to comment #12)
> (In reply to comment #11)
> [...]
> > What I don't understand is why your system can't find the iccprofiles
> > directory. It seems to be present, correctly named and in a location which the
> > search path ought to find, yet it persists in not finding it.
> > 
> > When I do the same here (on Fedora 14) it works, and even if I don't configure
> > GS properly it doesn't seg fault, it just exists with an error.
> So, may be dirrefent gcc, bintuils? I'm using currently:
> [terminal]
> $ gcc --version
> gcc (GCC) 4.6.1
> Copyright (C) 2011 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> [/terminal]
> 
> [terminal]
> $ ld --version
> GNU ld (GNU Binutils) 2.21.1.20110627
> Copyright 2011 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or (at your option) a later version.
> This program has absolutely no warranty.
> [/terminal]
Also:
[terminal]
$ uname -a
Linux smoon2 2.6.39.2-zen-ARCH-00415-gd111fdb #1 ZEN SMP PREEMPT Mon Jun 27 10:46:31 IRKST 2011 x86_64 Intel(R) Core(TM)2 Duo CPU T5450 @ 1.66GHz GenuineIntel GNU/Linux
[/terminal]

> 
> > The only thing I can think of is to check that you have cleaned and rebuilt
> > 9.03 completely ? 
> 
> I'll try to install several OS into VirtualBox and check, but only lately.
Comment 14 Alex Cherepanov 2011-07-07 18:21:05 UTC
I can reproduce the problem but don't see yet how to fix it.
On Henry's request the bug gets the top priority and severity ratings.
Comment 15 Alex Cherepanov 2011-07-08 18:08:46 UTC
Current version of gs doesn't crash but it fails during the start-up,
which is about the same thing.

$ ~/ghostpdl/gs/debugbin/gs  -I/home/alexcher/ghostpdl/gs/Resource/Init -sDEVICE=pdfwrite logimage_.eps 

GPL Ghostscript GIT PRERELEASE 9.03 (2011-03-30)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
sfopen: gs_parse_file_name failed.
sfopen: gs_parse_file_name failed.
  ./base/gsicc_manage.c:901: gsicc_open_search(): Could not find default_rgb.icc 
| ./base/gsicc_manage.c:1155: gsicc_set_device_profile(): cannot find device profile
**** Unable to open the initial device, quitting.

I see the root cause of the problem in DEFAULT_DIR_ICC.
When %rom% file system is available, the default value is OK and all problems in the device initialization logic are hidden.
Comment 16 Till Kamppeter 2011-07-16 16:41:46 UTC
Also reported at Ubuntu:

https://bugs.launchpad.net/gs-gpl/+bug/811564

Most probably 9.04 (GIT of July 15, 2011) is used there.
Comment 17 Chris Liddell (chrisl) 2011-07-27 15:12:09 UTC
This was fixed by commit:

http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=10cd4a