I am trying the current SVN state of Ghostscript without installing it, directly out of the compiled source tree. I run LD_PRELOAD=sobin/libgs.so GS_LIB=./Resource/Init/:./iccprofiles:./lib sobin/gsc ~/ghostscript/gpl/testfiles/CityMap.pdf This leads to the following error: ./base/gsicc_manage.c:702: gsicc_open_search(): Could not find default_gray.icc in ./iccprofiles checking default paths sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:720: gsicc_open_search(): Could not find default_gray.icc in root directory | ./base/gsicc_manage.c:814: gsicc_set_device_profile(): cannot find device profile **** Unable to open the initial device, quitting. ./base/gsicc_manage.c:702: gsicc_open_search(): Could not find default_gray.icc in ./iccprofiles checking default paths sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:720: gsicc_open_search(): Could not find default_gray.icc in root directory | ./psi/zusparam.c:580: set_default_gray_icc(): cannot find default gray icc profile and I have added ./iccprofiles to GS_LIB, as you see in the command line. I have asked on IRC and Ken Sharp told me that Ghostscript's standard search path is also searched for ICC profiles and not only for fonts and PS files. For now, only LD_PRELOAD=sobin/libgs.so GS_LIB=./Resource/Init/:./iccprofiles:./lib sobin/gsc -sICCProfilesDir=./iccprofiles/ ~/ghostscript/gpl/testfiles/CityMap.pdf works for me, which is somewhat awkward.
On a more complex command line, like this one cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so GS_LIB=./Resource/Init/:./iccprofiles:./lib:./soobj sobin/gsc -sICCProfilesDir=./iccprofiles/ -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -sICCProfilesDir=./iccprofiles/ -c -f -_ > out.raster 2> log even '-sICCProfilesDir=./iccprofiles/' does not work. I get sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:720: gsicc_open_search(): Could not find default_rgb.icc in root directory | ./base/gsicc_manage.c:814: gsicc_set_device_profile(): cannot find device profile in the stderr output file "log".
It may be the -dPARANOIDSAFER (just a hunch). We probably need to look at the file permissions (PermitFileReading list of paths), but I'm not sure that the ICC profile reading is even checking this. What is needed in gs_init.ps is to add the ICCProfilesDir (whether it is set from the command line -sICCProfilesDir or from internal default logic) to the PermitFileReading list, similarly to the way GenericResourceDir is handled. Then we also need to make sure that the gsicc_manage.c is using the file access methods that respect the lists. The goal is to make sure that a PS file that sets the ICCProfilesDir will not be able to force reading of arbitrary directories (even if it is read by the ICC code and the data not accessible to the PS program). These security issues may not be exactly 'on topic', so if desired we can open a new bug for this.
After removing the "-dPARANOIDSAFER" the problem still persists.
What is needed is to set a default ICCProfilesDir similarly to the way it is we set a reasonable GenericResourceDir. Rather than looking for the existence of 'Init/gs_init.ps', we can look for 'default_gray.icc' on the path, then use the first 'sibling' to the GenericResourceDir that contains it. Michael can post any other comments about setting the default. Since this is in PS code, assigning to Alex for help.
Created attachment 6403 [details] patch Search for valid (iccprofiles) directory as a sibling to (Resource) and set it as a default if found.
I have tried the patch. Simple command lines, like LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -sPAPERSIZE=a4 /usr/share/system-config-printer/testpage-a4.ps and LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -sPAPERSIZE=a4 ../testfiles/CImg_flyer.pdf work now, but cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> log still does not work. The latter still says that it cannot find the ICC profiles (in the "log" file).
Removing -dPARANOIDSAFER from the last command line does not solve the problem.
Problem occurs also with the "png16m" device. Only difference is that rendering continues after the error with the result that the error repeats 189 times in the log file and the resulting image (out.png) is broken. Command line: cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -dQUIET -dNOPAUSE -dBATCH -sDEVICE=png16m -sstdout=%stderr -sOutputFile=%stdout -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -_ > out.png 2> log Error output in "log" (occurs 189 times): sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:720: gsicc_open_search(): Could not find default_rgb.icc in root directory | ./base/gsicc_manage.c:814: gsicc_set_device_profile(): cannot find device profile Attaching the input PDF file.
Created attachment 6418 [details] launch_leaflet.pdf PDF file with which the problem occurs.
The same command line with GS 8.71 leads to an empty log file and out.png being a correct image of the first page.
(In reply to comment #10) > The same command line with GS 8.71 leads to an empty log file and out.png being > a correct image of the first page. first page (with "invisible" garbage added to the end of png file) is probably the correct behavior, since you are outputting to stdout and did not have an explicit -sOuputFile=out%d.png to split pages to separate files.
looking at Alex's patch, I think you need to set GS_LIB=<otherthings>:Resource or even GS_LIB=<otherthings>:Resource/../ . As far as I understand how Alex's patch work, it tries to set the icc search directory by looking at any part of GS_LIB which contains "Resource" and append iccprofile to it (or its parent?). (I think it tries to append to "Resource" (i.e. use it as parent), rather than "Resource"/.. (use "Resource" as sibling, according to the comment), but I could be wrong there ; also, I am not sure if concatstrings adds path separators ("/")? may be worth checking)
Hin-Tak, it does not help, also adding the paths with trailing "/" does not help.
I have built the current snapshot (rev r11463) with the following command lines: CFLAGS="-fPIC" ./autogen.sh --prefix=/usr --sysconfdir=/etc --with-ijs --with-jbig2dec --with-jasper --with-x --disable-gtk --enable-dynamic --with-omni --enable-cups --disable-compile-inits --with-drivers=ALL --disable-cairo --with-fontpath=/var/lib/defoma/gs.d/dirs/fonts:/usr/share/cups/fonts:/usr/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/fonts make so
Ray asked for adding "currentuserparams /ICCProfilesDir get (ICCProfilesDir set to ) print == flush" between the -c and the -f at the end of the command line and I get the additional line ICCProfilesDir set to (NULL) appears in the "log" file. Also LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -q -sICCProfilesDir=iccprofiles/ -c "currentuserparams /ICCProfilesDir get == flush quit" (and the same command line under Windows, tested by Ray) gives "(NULL)".
Quick patch to actually print out the ICCProfilesDir setting: Index: psi/zusparam.c =================================================================== --- psi/zusparam.c (revision 11480) +++ psi/zusparam.c (working copy) @@ -649,9 +649,9 @@ static void current_default_dir_icc(i_ctx_t *i_ctx_p, gs_param_string * pval) { - static const char *const rfs = "NULL"; - pval->data = (const byte *)rfs; - pval->size = strlen(rfs); + const gs_imager_state * pis = (gs_imager_state *) igs; + pval->data = (const byte *)pis->icc_manager->profiledir; + pval->size = pis->icc_manager->namelen; pval->persistent = true; }
Ray, thank you for the patch, after applying it, I get the same result as you: till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -q -sICCProfilesDir=iccprofiles/ -c "currentuserparams /ICCProfilesDir get == flush quit" (iccprofiles/\000) till@till:~/ghostscript/gpl/gs-test$
Since you are testing in ~/ghostscript/gpl/gs-test what is in your iccprofiles/ path ? Note that the trailing <nul> is NOT a problem for the ICC profile search code, in fact, it relies on it. Michael is looking to fixing the zusparam.c to make the PS strings print correctly, but the current code NEEDS the trailing <nul> on the string (as will the future code -- it just won't be visible to PS). The next thing to test is what happens WITHOUT the explicit: -sICCProfilesDir=iccprofiles/ option. This way we can see what is getting set by Alex's patch (which ONLY runs if it is NOT previously defined).
My gs-test is the root directory of the Ghostscript source. So I have Resource/ and iccprofiles/ directly in my working directory. Without "-sICCProfilesDir=iccprofiles/" I get the same result: till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -q -c "currentuserparams /ICCProfilesDir get == flush quit" (iccprofiles/\000) till@till:~/ghostscript/gpl/gs-test$
With GS_LIB=Resource/Init:lib I think ICCProfilesDir should be set to the value shown in comment #19: (iccprofiles/) i.e., the sibling to Resource/ Note that I suggest that if the %rom% file system is present, then the default ICCProfilesDir should be set to %rom%iccprofiles/ which will have the needed profiles. PS can test for the existence of %rom%Resource/Init/gs_init.ps and if it is there, set ICCProfilesDir to %rom%iccprofiles/
Created attachment 6450 [details] gs_lev2.ps.patch A revised patch that sets the ICCProfilesDir to %rom%iccprofiles/ if the %rom% file system is detected. Alex, please review and commit after any changes you want to make.
After having updated to SVN rev 11499, rebuilt, applied the patch from comment #21 I get till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -q -c "currentuserparams /ICCProfilesDir get == flush quit" While reading gs_lev2.ps: Error: /undefinedfilename in --status-- Operand stack: (gs_lev2.ps) --dict:30/30(G)-- (%rom%Resource/Init/gs_init.ps) Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- Dictionary stack: --dict:769/1123(G)-- --dict:70/200(L)-- --dict:769/1123(G)-- --dict:133/251(G)-- --dict:21/25(L)-- Current file position is 23439 sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find default_gray.icc in root directory | ./psi/zusparam.c:592: set_default_gray_icc(): cannot find default gray icc profile Unrecoverable error: undefined in .uninstallpagedevice Operand stack: gs_lev2.ps --nostringval-- %rom%Resource/Init/gs_init.ps till@till:~/ghostscript/gpl/gs-test$ I have built as described before in this bug, without %rom% file system.
Did another "svn update" and now I get: till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -q -c "currentuserparams /ICCProfilesDir get == flush quit" While reading gs_fntem.ps: Error: /undefinedresource in findresource Operand stack: (gs_fntem.ps) 1 FontEmulationProcs encodingnames --nostringval-- --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding Wingdings Wingdings Encoding Wingdings Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- 1847 17 5 %oparray_pop --nostringval-- --nostringval-- --dict:17/21(ro)(G)-- --dict:8/8(G)-- --nostringval-- 2 %dict_continue --nostringval-- --nostringval-- 1845 24 5 %oparray_pop findresource %errorexec_pop --nostringval-- --nostringval-- Dictionary stack: --dict:949/1123(G)-- --dict:0/20(G)-- --dict:71/200(L)-- --dict:949/1123(G)-- --dict:10/10(G)-- --dict:17/21(ro)(G)-- Current allocation mode is global Last OS error: 2 Current file position is 7074 sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:704: gsicc_open_search(): Could not find lab.icc in %rom%iccprofiles/ checking default paths sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find lab.icc in root directory | ./psi/zusparam.c:806: set_lab_icc(): cannot find default lab icc profile Unrecoverable error: undefined in .uninstallpagedevice Operand stack: gs_fntem.ps 1 FontEmulationProcs encodingnames --nostringval-- --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding Wingdings Wingdings Encoding till@till:~/ghostscript/gpl/gs-test$
Good, we are making progress. This is EXACTLY the results I see on Windows with a COMPILE_INITS=0 and with -IResource/Init but no -P or -I. Adding Chris to this since he may be able to investigate the error in gs_fntem.ps Note that the -dOSTACKPRINT -dESTACKPRINT (which may provide more info) will be attached.
Created attachment 6451 [details] Expanded_error.txt
This kept bugging me, so I looked into it some more. Chris, you can ignore this bug (as far as it being a font specific issue). The problem is that with the -P- default condition (SEARCH_HERE_FIRST=0), the 'lib_file_open' logic gets called in order to load the file from Resource/Encoding/Wingdings) and ends up taking the path at zfile.c:1009 that sets search_with_no_combine = starting_arg_file; search_with_combine = true; and since 'starting_arg_file' is now 0 (because of the -P- default) it does not allow 'search_with_no_combine'. Since GS_LIB=Resource/Init:lib it checks for the existence of: "Resource/Init/Resource/Encoding/Wingdings" "lib/Resource/Encoding/Wingdings" and various other GS_LIB_DEFAULT paths. Thus when -P- is the default (or SEARCH_HERE_FIRST=0 in the makefile), we cannot find Resource files when the GenericResourceDir ends up as a relative path (non-absolute). Note that setting -sGenericResourceDir=Resource/ or ./Resource/ also does not help this -- the file name is seen as not absolute, so does also only searches for file names prepended with the lib paths. Setting an absolute path works fine for me. Till should be able to work with: GS_LIB=~/ghostscript/gpl/gs-test/Resource/Init:~/ghostscript/gpl/gs-test/lib (assuming that the shell expands ~ to an absolute path). This raises concern about the decision to make SEARCH_HERE_FIRST=0 as the default for the future. It may cause a lot of folks to have problems accessing Resource files when COMPILE_INITS=0 Adding this comment to that bug as well and reopening it.
Using absolute paths I get till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=~/ghostscript/gpl/gs-test/Resource/Init:~/ghostscript/gpl/gs-test/lib sobin/gsc -q -c "currentuserparams /ICCProfilesDir get == flush quit"(/home/till/ghostscript/gpl/gs-test/iccprofiles/) till@till:~/ghostscript/gpl/gs-test$ which is expected behavior. But till@till:~/ghostscript/gpl/gs-test$ cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=~/ghostscript/gpl/gs-test/Resource/Init:~/ghostscript/gpl/gs-test/lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> logtill@till:~/ghostscript/gpl/gs-test$ still gives the errors. The errors in the file "log" are: sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find default_rgb.icc in root directory | ./base/gsicc_manage.c:816: gsicc_set_device_profile(): cannot find device prof ile
(In reply to comment #27) > Using absolute paths I get > which is expected behavior. Using absolute paths and works is the desirable behavior. There is some security-related debates about whether and how relative paths should work. OTOH, I just look at the code, and before the release, "make install" needs to acquire some machineries for installing the icc profiles. I'll file a new bug for this.
Bug 691449 filed for "make install" to put the default icc profiles somewhere, if compile-inits=0 .
When resolving this (and also bug #691449), it would be welcome were the iccprofiles dir moved into Resources. There is no need to add another dir to Resources/.., and it seems like it should make everything easier.
Created attachment 6483 [details] patch This is slightly improved version of my patch that doesn't require a trailing slash in the source path. I didn't include %rom% trick because I don't see why %rom% file system is different from any other. We need to discuss this. If LIBPATH has a patch to %rom%Resource, my patch works. If not, why %rom% system should be considered ? The patch also includes a fix for the bug 691350, which doesn't combine the file name with search directories when it makes no sense. Earlier code relied on special handling of absolute path by findlibfile procedure.
This one works with the new patch: till@till:~/ghostscript/gpl/gs-test$ LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=~/ghostscript/gpl/gs-test/Resource/Init:~/ghostscript/gpl/gs-test/lib sobin/gsc -q -c "currentuserparams /ICCProfilesDir get == flush quit" (/home/till/ghostscript/gpl/gs-test/iccprofiles/) till@till:~/ghostscript/gpl/gs-test$ and this one still fails: till@till:~/ghostscript/gpl/gs-test$ cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource/Init:lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> log till@till:~/ghostscript/gpl/gs-test$ The file "log" contains: While reading gs_fntem.ps: Error: /undefinedresource in findresource Operand stack: (gs_fntem.ps) 1 FontEmulationProcs encodingnames --nostringval-- --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- StandardEncoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- ISOLatin1Encoding Wingdings Wingdings Encoding Wingdings Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- 1847 17 5 %oparray_pop --nostringval-- --nostringval-- --dict:17/21(ro)(G)-- --dict:8/8(G)-- --nostringval-- 6 %dict_continue --nostringval-- --nostringval-- 1845 24 5 %oparray_pop findresource %errorexec_pop --nostringval-- --nostringval-- Dictionary stack: --dict:964/1123(G)-- --dict:0/20(G)-- --dict:71/200(L)-- --dict:964/1123(G)-- --dict:10/10(G)-- --dict:17/21(ro)(G)-- Current allocation mode is global Last OS error: 2 Current file position is 7074 sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:704: gsicc_open_search(): Could not find lab.icc in %rom%iccprofiles/ checking default paths sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find lab.icc in root directory | ./psi/zusparam.c:806: set_lab_icc(): cannot find default lab icc profile Unrecoverable error: undefined in .uninstallpagedevice Operand stack: gs_fntem.ps 1 FontEmulationProcs encodingnames --nostringval-- --nostringval-- StandardEncoding --nostringval-- ISOLatin1Encoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- StandardEncoding --nostringval-- SymbolEncoding --nostringval-- DingbatsEncoding --nostringval-- ISOLatin1Encoding Wingdings Wingdings Encoding
Trying with GS_LIB=Resource:Resource/Init:lib, according to a hint from Alex on IRC: cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource:Resource/Init:lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> log This also does not work. "log" contains: While reading gs_res.ps: Error: /rangecheck in --getinterval-- Operand stack: (gs_res.ps) (Resource) () 0 1 Execution stack: %interp_exit --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- Dictionary stack: --dict:787/1123(G)-- --dict:70/200(L)-- --dict:787/1123(G)-- --dict:166/251(G)-- --dict:787/1123(G)-- --dict:23/40(ro)(G)-- Current file position is 11417 sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:704: gsicc_open_search(): Could not find lab.icc in %rom%iccprofiles/ checking default paths sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find lab.icc in root directory | ./psi/zusparam.c:806: set_lab_icc(): cannot find default lab icc profile Unrecoverable error: undefined in .uninstallpagedevice Operand stack: gs_res.ps Resource 0 1
Created attachment 6486 [details] improved patch This is an improved version of the last patch that tolerates directory names without a trailing separator, '/'. Ghostscript startup code need both "Resource" and "Resource/Init" on the search path. Trailing separators are now optional.
Applied the patch to SVN HEAD (rev 11508) , rebuilt, and ran following command line: cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource:Resource/Init:lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> log This still failed, but at least came over the initialization and started to render the input file. "log" contains: sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find default_rgb.icc in root directory | ./base/gsicc_manage.c:816: gsicc_set_device_profile(): cannot find device prof ile and after that GS errors out with Error: /unknownerror in --showpage--
I've reproduced the last problem. No cups, environment variables, or shared libraries needed -- just a high resolution to force banded rendering and the absence of "%rom%iccprofiles/" . -P option doesn't help. My gs is configured to have no build-in valid search paths. debugobj/gs -P -IResource -IResource/Init -r720 -o /dev/null \ -sDEVICE=bmp16m -c showpage The problem is caused by NULL value of icc_manager->profiledir during band playback.
Created attachment 6493 [details] Patch for Resoirce/ in LIBPATH Fix the bug that prevented recognition of GenericResourceDir/Category/Name as a valid resource path and required inclusion of GenericResourceDir in the search path by re-implementing ResourceFileName procedure. New procedure does the following: 1. Return GenericResourceDir/Category/Name if it exists. 2. Searches for Category/Name in LIBPATH. Returns actual path if found. 3. For non-existing resources return the same path as (1). Old implementation added GenericResourceDir twice, didn't close files, used system memory, called expensive procedures twice, etc. Regression testing shows trivial differences in 23-07.ps, which prints the length of ResourceFileName procedure.
Tried the patch. The command line cat ~/ghostscript/gpl/testfiles/launch_leaflet.pdf | PPD=/etc/cups/ppd/R220.ppd LD_PRELOAD=sobin/libgs.so.8.72 GS_LIB=Resource:Resource/Init:lib sobin/gsc -dQUIET -dPARANOIDSAFER -dNOPAUSE -dBATCH -sDEVICE=cups -sstdout=%stderr -sOutputFile=%stdout -I/usr/share/cups/fonts -sMediaClass=Standard -sMediaType=Plain -r720x720 -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=842 -dcupsBitsPerColor=8 -dcupsColorOrder=0 -dcupsColorSpace=1 -dcupsRowFeed=5 -scupsPageSizeName=A4 -c -f -_ > out.raster 2> log errors out with sfopen: gs_parse_file_name failed. ./base/gsicc_manage.c:722: gsicc_open_search(): Could not find default_rgb.icc in root directory | ./base/gsicc_manage.c:816: gsicc_set_device_profile(): cannot find device prof ile in "log" again. The command line works with the resolution reduced to 100x100 dpi (this probably avoids banding).
LD_PRELOAD=sobin/libgs.so.8.72 sobin/gsc -P -IResource -IResource/Init -r720 -o /dev/null -sDEVICE=bmp16m -c showpage also errors out as before.
Patch from the comment #37 doesn't address the access to ICC profiles in the banded rendering. So no progress in this respect is expected. The patch makes "Resource" directory unnecessary in the search path.
IT WORKS !!! Thank you very much, Michael, your fix in SVN rev 11514 makes my command line correctly working. Now Ghostscript 9.00 is ready for being packaged in the version under development of Ubuntu Maverick (10.10.10).
Till, I want to make sure that you don't "jump the gun" on releasing 9.00. Please do not package up a pre-release 9.00 as we still have not finished our full analysis of the readiness and done the release. Having multiple "9.00" versions out there causes us a real pain in support. I _am_ glad that you think that it is ready!
I do not put an unreleased Ghostscript into a released distro. As Ghostscript 9.00 will be released before Ubuntu's Feature Freeze, at least if one assumes that Ghostscript continues the 6-months release cycle. Ubuntu will go gold with GS 9.00 final. My intentions to package a pre-release for the Ubuntu under development is simply to make a wider community testing the new GS before it gets released. But if you think it is not a good idea, I can wait for the release of 9.00. I will anyway try out the new GS on my collected test files from Ubuntu bug reports and report further bugs here.
Till, thanks for the clarification. I encourage 'pre-release' (as unstable) versions that include the 9.00 PRE-RELEASE. Ralph Giles attempted to establish our release cycles to precede (slightly) the linux distro releases, so it sounds like we are in agreement. Thanks again for you (and all of the other testers of pre-release ubuntu) for feedback. With 9.00 and ALL of its new features and (a few) changed that are not backward compatible (the SEARCH_HERE_FIRST=0/-P- default) the more testing we get before release the better. We are in a phase of evaluating which bugs are 'release blockers' so if you have any candidates, let us know.