Bug 969660 - Error: /limitcheck in /findfont for any files that requires the standard 13 fonts.
Error: /limitcheck in /findfont for any files that requires the standard 13 f...
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: ghostscript (Show other bugs)
18
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Tim Waugh
Fedora Extras Quality Assurance
: Patch, Reopened
: 845984 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-01 11:12 EDT by Hin-Tak Leung
Modified: 2013-12-10 01:08 EST (History)
7 users (show)

See Also:
Fixed In Version: ghostscript-9.06-8.fc18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-08-09 09:43:31 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
one postcript file generated by enscript , which shows this problem (26.95 KB, application/postscript)
2013-06-01 11:12 EDT, Hin-Tak Leung
no flags Details
strace -eopen gs a.ps >& /tmp/whole-list (204.23 KB, text/plain)
2013-06-03 07:41 EDT, Hin-Tak Leung
no flags Details
patch to clamp the name to 65535. (544 bytes, patch)
2013-06-14 20:17 EDT, Hin-Tak Leung
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
Ghostscript 690692 None None None Never

  None (edit)
Description Hin-Tak Leung 2013-06-01 11:12:25 EDT
Created attachment 755549 [details]
one postcript file generated by enscript , which shows this problem

Description of problem:
For a number of years now, ghostscript on fedora running against any ps files which requires the standard 13 fonts (basically those generated by a2ps or enscript) fails with:

$ gs gs-redhat-buzilla.ps 
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file /usr/share/ghostscript/9.06/Resource/Font/NimbusMonL-Bold.
Can't find (or can't open) font file NimbusMonL-Bold.
Can't find (or can't open) font file /usr/share/ghostscript/9.06/Resource/Font/NimbusMonL-Bold.
Can't find (or can't open) font file NimbusMonL-Bold.
Querying operating system for font files...
Error: /limitcheck in /findfont
Operand stack:
   fontdict   Courier-Bold
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1852   2   3   %oparray_pop
Dictionary stack:
   --dict:1161/1684(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--
Current allocation mode is local
Current file position is 10654
GPL Ghostscript 9.06: Unrecoverable error, exit code 1

Version-Release number of selected component (if applicable):
$ rpm -q ghostscript
ghostscript-9.06-4.fc18.x86_64
ghostscript-9.06-4.fc18.i686

How reproducible:
Always, for a number of years now.

Steps to Reproduce:
1. run a2ps or enscript on any text file.
2. type "gs gs-redhat-buzilla.ps"
3.

Actual results:
$ gs gs-redhat-buzilla.ps 
GPL Ghostscript 9.06 (2012-08-08)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file /usr/share/ghostscript/9.06/Resource/Font/NimbusMonL-Bold.
Can't find (or can't open) font file NimbusMonL-Bold.
Can't find (or can't open) font file /usr/share/ghostscript/9.06/Resource/Font/NimbusMonL-Bold.
Can't find (or can't open) font file NimbusMonL-Bold.
Querying operating system for font files...
Error: /limitcheck in /findfont
Operand stack:
   fontdict   Courier-Bold
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1894   1   3   %oparray_pop   1893   1   3   %oparray_pop   1877   1   3   %oparray_pop   1771   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1852   2   3   %oparray_pop
Dictionary stack:
   --dict:1161/1684(ro)(G)--   --dict:0/20(G)--   --dict:107/200(L)--
Current allocation mode is local
Current file position is 10654
GPL Ghostscript 9.06: Unrecoverable error, exit code 1


Expected results:
Something similar to binary build from source:

$gs gs-redhat-buzilla.ps 
GPL Ghostscript GIT PRERELEASE 9.08 (2013-01-29)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading NimbusMonL-Bold font from %rom%Resource/Font/NimbusMonL-Bold... 3300584 1930164 3934392 2634395 1 done.
Loading NimbusMonL-Regu font from %rom%Resource/Font/NimbusMonL-Regu... 3300584 1981041 3934392 2643056 1 done.
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
>>showpage, press <return> to continue<<
GS>quit

Additional info:

I occasionally work on-and-off ghostscript, so there is always a build-from-source binary around, and two of my printers I am the author of the driver of, and most of the things I print are generated from latex and therefore always have embedded CMR fonts and not using the std 13, so it has never bothered me too much about the platform's gs binary not working, but it is curious. My only guess is that the platform gs is not happy with fontconfig (and possibly the large number of fonts - I have essentially done yum -y install \*font\*) , since fontconfig seems to be the main difference between built from source vs from fedora.
Comment 1 Tim Waugh 2013-06-03 06:40:31 EDT
Works for me.  I suspect one or more of the fonts you've got installed is bad in some way.  Perhaps try 'strace -eopen ...' and see which font it looked at last?
Comment 2 Hin-Tak Leung 2013-06-03 07:41:17 EDT
Created attachment 756268 [details]
strace -eopen  gs a.ps  >& /tmp/whole-list

strace -eopen does not show an error.

OTOH,
grep -i "\.ttf" /tmp/whole-list  | wc -l
519

$ fc-match -a Courier | wc -l
1597

$ fc-match -a Courier |  grep Courier
NotCourierSans.ttf: "NotCourierSans" "Regular"
NotCourierSans-Bold.ttf: "NotCourierSans" "Bold"
c0419bt_.pfb: "Courier 10 Pitch" "Regular"
c0583bt_.pfb: "Courier 10 Pitch" "Bold"
c0582bt_.pfb: "Courier 10 Pitch" "Italic"
c0611bt_.pfb: "Courier 10 Pitch" "Bold Italic"
Comment 3 Hin-Tak Leung 2013-06-03 08:01:36 EDT
Hmm, you might be on to something. The last font opened:

/usr/share/fonts/pagul/Pagul.ttf 

came from pagul-fonts, 
"A TrueType Font, which allows you to read and write in Saurashtra Script."

It is slightly strange as having non-english in the Style field with fc-match -a output.

However, doing:
 fc-match -a | cut -f 4 -d '"' | sort | uniq -c

I seems to have 14 fonts with non-English in that field, so if that's the reason, I have more problems than just that one font.

May I suggest if you could install pagul-fonts, and see if it breaks your system? :-)
Comment 4 Hin-Tak Leung 2013-06-03 08:23:39 EDT
The pagul-fonts package is part of fedora's offerings, so if it breaks gs, it would be between the packagers?

The other strange fonts with non-English/unusual styles are:

Perizia.ttf: "Perizia" "
Denemo.ttf: "Denemo" "obyčejné"
FreeSerifItalic.ttf: "FreeSerif" "курсивен"
FreeMonoOblique.ttf: "FreeMono" "наклонен"
FreeSansOblique.ttf: "FreeSans" "наклонен"
FreeMono.ttf: "FreeMono" "нормален"
FreeSans.ttf: "FreeSans" "нормален"
FreeSerif.ttf: "FreeSerif" "нормален"
FreeMonoBold.ttf: "FreeMono" "получерен"
FreeSansBold.ttf: "FreeSans" "получерен"
FreeSerifBold.ttf: "FreeSerif" "получерен"
FreeSerifBoldItalic.ttf: "FreeSerif" "получерен курсивен"
FreeMonoBoldOblique.ttf: "FreeMono" "получерен наклонен"
FreeSansBoldOblique.ttf: "FreeSans" "получерен наклонен"
Pagul.ttf: "Pagul" " 渀漀琀 瀀"

hiran-perizia-fonts, denemo-music-fonts, gnu-free-mono-fonts and pagul-fonts. Okay, not too painful if I need to remove them. Perizia seems to give a new-line for that field.
Comment 5 Tim Waugh 2013-06-03 09:53:47 EDT
Yes, indeed, installing pagul-fonts causes my system to fail in the same way. Thanks for narrowing down the problem.
Comment 6 Hin-Tak Leung 2013-06-14 20:17:33 EDT
Created attachment 761469 [details]
patch to clamp the name to 65535.

The font is legal I think (and was created by fontforge, apparently), but the creator was being creative and put the entire text of the GPL inside the name table. Ghostscript reads the name table as string and is limited by postscript's implementation limit of string to 65535 (Appendix B1, PLRM).

Out of the 1200+ truetype-like fonts on my system, I have 10 fonts with name above 47k and the 2nd highest being 56559 . So while being extreme, close to 65535 is not too rare.
Comment 7 Hin-Tak Leung 2013-06-14 20:33:05 EDT
The name is 108959 in size, and the GPL appeared to be UTF-16 encoded in the hex editor. That basically doubles the text size from about 35k to 70k. So just on its own, that part is over 65535... The limitcheck comes from readstring.
Comment 8 Hin-Tak Leung 2013-06-14 20:35:40 EDT
The upstream bug report may or may not be the same problem, but likely in a similar code area.
Comment 9 Tim Waugh 2013-06-18 11:47:47 EDT
FWIW, I can't reproduce the problem on Fedora 19 Beta (ghostscript-9.07).
Comment 10 Hin-Tak Leung 2013-06-18 15:06:25 EDT
AFAIK, the pagul font in F19 is the same.

It is possible with a different fontconfig config, the target font is found before encountering the flawed font. You could do a full scan by searching for a bogus font:

/ZZXTZNZRZPSMTWhatnot findfont

Or scan a specific font specifically:

(/usr/share/fonts/ipa-gothic/ipag.ttf) (r) file .findttfontname not {(failed)} if =

The former should take a while but come back to a message about font not found and substituting with something else; the latter should give you the font name for a ttf or a otf file ("IPAGothic" in the above case, or "Pagul" for the pagul font), or one word "failed" if you feed it an invalid file, but neither should throw a postscript limitcheck error.

Those two lines are postscript code - you just start gs and cut-&-paste that in, or stick them in a file and run "gs file.ps"
Comment 11 Hin-Tak Leung 2013-06-25 22:23:24 EDT
A somewhat edited and integrated patch together with another fix for a related issue was committed as part of the upstream bug report Ghostscript #690692, so this patch can be dropped when the next version of ghostscript is released.

The other issue addressed by the integrated patch is for Mac OS dfont font formats (detecting and skipping them correctly), so not particularly useful/urgent for Fedora.
Comment 12 Fedora Update System 2013-07-17 12:28:48 EDT
ghostscript-9.07-10.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ghostscript-9.07-10.fc19
Comment 13 Fedora Update System 2013-07-18 01:47:23 EDT
Package ghostscript-9.07-10.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ghostscript-9.07-10.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-13173/ghostscript-9.07-10.fc19
then log in and leave karma (feedback).
Comment 14 Fedora Update System 2013-07-20 05:36:45 EDT
ghostscript-9.07-10.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 15 Tim Waugh 2013-07-25 04:48:11 EDT
*** Bug 845984 has been marked as a duplicate of this bug. ***
Comment 16 Marc-Andre Laverdiere 2013-08-08 11:21:41 EDT
I have an up-to-date system and I can confirm that ghostscript-9.07-10.fc19 is installed.

I have reported the issue originally thinking it was due to Okular

I am trying to open that PDF with gs and I get
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Didn't find this font on the system!
Unable to substitute for font.
   **** Error reading a content stream. The page may be incomplete.
   **** File did not complete the page properly and may be damaged.


When trying to use the ps version of that PDF I get

GPL Ghostscript 9.07 (2013-02-14)
Copyright (C) 2012 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Querying operating system for font files...
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusMonL-Regu.
Can't find (or can't open) font file NimbusMonL-Regu.
Didn't find this font on the system!
Unable to substitute for font.
Error: /invalidfont in /findfont
Operand stack:
   F0_999999   1   1   --nostringval--   Courier
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1884   1   3   %oparray_pop   1883   1   3   %oparray_pop   1867   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   1836   5   4   %oparray_pop
Dictionary stack:
   --dict:1163/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:67/75(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 12568
GPL Ghostscript 9.07: Unrecoverable error, exit code 1
Comment 17 Rex Dieter 2013-08-08 11:41:17 EDT
Re-opening based on comment #16
Comment 18 Hin-Tak Leung 2013-08-08 23:05:39 EDT
(In reply to Marc-Andre Laverdiere from comment #16)
> I have an up-to-date system and I can confirm that ghostscript-9.07-10.fc19
> is installed.
...
> Didn't find this font on the system!
> Unable to substitute for font.

Can you post the /tmp/whole-list generated from (all in one line)

strace -eopen gs -dNOPAUSE -dBATCH -dDEBUG your_input_file.ps  >& /tmp/whole-list

the next time you have one of these message with one of your your_input_file.ps ?
That would help.
Comment 19 Tim Waugh 2013-08-09 03:58:31 EDT
Is this the same bug? The original report had /limitcheck, but your run ends with /invalidfont.
Comment 20 Marc-Andre Laverdiere 2013-08-09 09:41:16 EDT
Tim Waugh is right. I have given the information in the following bug.
https://bugzilla.redhat.com/show_bug.cgi?id=990995
Comment 21 Rex Dieter 2013-08-09 09:43:31 EDT
OK, re-closing.  Long live bug #969660 !
Comment 22 Adriaan J. van Wijngaarden 2013-09-09 15:07:40 EDT
For those who have an earlier Fedora version, it is easy to resolve the problem using 

yum remove pagul-fonts
Comment 23 Fedora Update System 2013-09-26 10:57:12 EDT
ghostscript-9.06-8.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/ghostscript-9.06-8.fc18
Comment 24 Fedora Update System 2013-12-10 01:08:07 EST
ghostscript-9.06-8.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.