Bug 1653706 - ps2pdf fails after fontconfig upgrade in RHEL 7.6
Summary: ps2pdf fails after fontconfig upgrade in RHEL 7.6
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ghostscript
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Osvald 🛹
QA Contact: Petr Sklenar
URL:
Whiteboard:
: 1660610 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-27 13:20 UTC by Rik Theys
Modified: 2019-08-06 13:12 UTC (History)
7 users (show)

Fixed In Version: ghostscript-9.25-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-06 13:12:44 UTC
Target Upstream Version:


Attachments (Terms of Use)
test case (147.65 KB, application/postscript)
2018-11-28 11:22 UTC, Rik Theys
no flags Details
backported patch (1.81 KB, patch)
2018-12-03 08:52 UTC, Martin Osvald 🛹
no flags Details | Diff


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:2281 None None None 2019-08-06 13:12:59 UTC

Description Rik Theys 2018-11-27 13:20:05 UTC
Description of problem:
After the upgrade to RHEL 7.6 with an updated fontconfig package, the ps2pdf command fails to compile a ps file that contains eps graphics (such as files created by latex with eps graphics).

$ ps2pdf 9dmnn_lecture00.ps
Error: /typecheck in /findfont
Operand stack:
   --nostringval--   Times-Roman
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--   1836   2   6   %oparray_pop
Dictionary stack:
   --dict:1170/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--   --dict:189/300(L)--   --dict:75/200(L)--   --dict:42/200(L)--
Current allocation mode is local
Current file position is 152636
GPL Ghostscript 9.07: Unrecoverable error, exit code 1


This only triggers if a font is installed that contains a .woff file, such as fontawesome-fonts-web

Downgrading the fontconfig packages to the version from 7.5 does not trigger this error message.

Version-Release number of selected component (if applicable):
fontconfig-2.13.0-4.3.el7.x86_64

How reproducible:


Steps to Reproduce:
1. Upgrade fontconfig
2. Install fontawesome packages from epel
3. Try to compile a latex file with an eps figure to pdf

Actual results:
The error shown above

Expected results:
ps2pdf generates the pdf file as it did with previous versions of fontconfig.

Additional info:

Comment 3 Akira TAGOH 2018-11-28 10:01:57 UTC
Can you provide a test case?

Comment 4 Rik Theys 2018-11-28 11:22:30 UTC
Created attachment 1509447 [details]
test case

Hi,

I've further debugged the issue and the broken package is not fontconfig but freetype.

Steps to reproduce:

1. Install fontawesome-fonts-web from EPEL, this include a .woff file
2. On an updated 7.6, run:

fc-cache -f
ps2pdf testcase.ps

This throws an error about /typecheck in /findfont

3. Downgrade freetype, pango and fontconfig packages to the 7.5 version

fc-cache -f 
ps2pdf testcase.ps

it works now!

It's important to run fc-cache as otherwise it sometimes keeps on breaking/working.

4. Upgrade only freetype to the 7.6 version

fc-cache -f
ps2pdf testcase.ps

-> broken again.


This can also explain other broken font behaviour we're seeing on 7.6 but I have yet to verify that.

Comment 5 Akira TAGOH 2018-11-29 09:20:12 UTC
FYI, tried this on f29:
$ rpm -q freetype fontconfig ghostscript
freetype-2.9.1-6.fc29.x86_64
fontconfig-2.13.1-3.fc29.x86_64
ghostscript-9.25-1.fc29.x86_64
$ gs
GPL Ghostscript 9.25 (2018-09-13)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>/Times-Roman findfont
Loading NimbusRoman-Regular font from /usr/share/ghostscript/Resource/Font/NimbusRoman-Regular... 4511208 2915215 2752200 1462198 1 done.
GS<1>
$ ls -l /usr/share/ghostscript/Resource/Font/NimbusRoman-Regular
lrwxrwxrwx. 1 root root 50 Sep 17 10:19 /usr/share/ghostscript/Resource/Font/NimbusRoman-Regular -> /usr/share/fonts/urw-base35/NimbusRoman-Regular.t1
$ rpm -qf /usr/share/ghostscript/Resource/Font/NimbusRoman-Regular
libgs-9.25-1.fc29.x86_64
$ rpm -qf /usr/share/fonts/urw-base35/NimbusRoman-Regular.t1
urw-base35-nimbus-roman-fonts-20170801-11.fc29.noarch

Maybe good to try what fonts were picked up with the previous version of packages.

and on RHEL7:
$ rpm -q freetype fontconfig ghostscript
freetype-2.8-12.el7.x86_64
fontconfig-2.13.0-4.3.el7.x86_64
ghostscript-9.07-31.el7.x86_64
$ gs
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
DEBUG: FC_WEIGHT didn't match
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Didn't find this font on the system!
Substituting font Courier for NimbusRomNo9L-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.
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:
   Times-Roman
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1836   1   3   %oparray_pop
Dictionary stack:
   --dict:1163/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: Not a directory
Current file position is 22
GS<1>

That looks like something wrong on ghostscript to me though...

Comment 6 Rik Theys 2018-11-29 10:08:36 UTC
Hi

It's correct that F29 does not have this issue.

Did you also have fontawesome-fonts-web installed on both F29 and RHEL7 (available in EPEL for RHEL)?

I don't think this is only ghostscript, as other bugs are also resolved by downgrading freetype (and running fc-cache -f). 

An example of an issue we're having that is also not present with the previous version freetype:

https://bugzilla.redhat.com/show_bug.cgi?id=1653300

Are you able to reproduce the issue with the instructions I provided in comment 4?

Regards,
Rik

Comment 7 Akira TAGOH 2018-11-29 10:45:02 UTC
(In reply to Rik Theys from comment #6)
> Did you also have fontawesome-fonts-web installed on both F29 and RHEL7
> (available in EPEL for RHEL)?

Yes but this happens without that font installed on rhel7. so that should be irrelevant. if you can't see the issue without that font, please provide a log of gs for that. that would helps to understand what happened on gs.

> An example of an issue we're having that is also not present with the
> previous version freetype:
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1653300

Added my comment there. that is different issue.

Comment 8 Rik Theys 2018-11-29 12:13:28 UTC
Hi,

I don't have the problem when the font is not installed. I've run the following three tests from a remote SSH session (with X forwarding enabled to have the gs window come up). Don't know if that influences the test.


1. Updated system with font installed:

[root@vierre64 ~]# rpm -q fontconfig freetype fontawesome-fonts-web
fontconfig-2.13.0-4.3.el7.x86_64
fontconfig-2.13.0-4.3.el7.i686
freetype-2.8-12.el7.x86_64
freetype-2.8-12.el7.i686
fontawesome-fonts-web-4.1.0-2.el7.noarch
[root@vierre64 ~]# gs
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Error: /typecheck in /findfont
Operand stack:
   Times-Roman
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1836   1   3   %oparray_pop
Dictionary stack:
   --dict:1166/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 22
GS<1>[root@vierre64 ~]# 


2. Upgraded system without font installed

[root@vierre64 ~]# fc-cache -f
[root@vierre64 ~]# rpm -q fontconfig freetype fontawesome-fonts-web
fontconfig-2.13.0-4.3.el7.x86_64
fontconfig-2.13.0-4.3.el7.i686
freetype-2.8-12.el7.x86_64
freetype-2.8-12.el7.i686
package fontawesome-fonts-web is not installed
[root@vierre64 ~]# gs
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 3580792 2140746 5555232 4231634 1 done.


3. Font installed but freetype and fontconfig downgraded:

[root@vierre64 ~]# fc-cache -f
[root@vierre64 ~]# rpm -q fontconfig freetype fontawesome-fonts-web
fontconfig-2.10.95-11.el7.x86_64
fontconfig-2.10.95-11.el7.i686
freetype-2.4.11-15.el7.x86_64
freetype-2.4.11-15.el7.i686
fontawesome-fonts-web-4.1.0-2.el7.noarch
[root@vierre64 ~]# gs
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 3580792 2141041 5571988 4245142 1 done.


Regards,
Rik

Comment 9 Akira TAGOH 2018-11-29 12:45:03 UTC
Hmm, I don't still understand how it is related to this and I can't reproduce 2) here. as the above logs says, gs picks up a font in urw-fonts. if I used same fontawesome-fonts packages, apparently there are no files contained modifying something related to urw-fonts. or do you have your own config for that?

Comment 10 Rik Theys 2018-11-29 12:50:19 UTC
Hi,

I've noticed that it's important that I run 'fc-cache -f' between each step otherwise I can not reproduce it. Did you run it between your tests?

Also, I believe the issue is that fontawesome-fonts-web contains a .woff file, which is what breaks it all. Maybe you have some other .woff file in /usr/share/fonts?

Regards,
Rik

Comment 11 Akira TAGOH 2018-11-30 05:59:24 UTC
(In reply to Rik Theys from comment #10)
> Hi,
> 
> I've noticed that it's important that I run 'fc-cache -f' between each step
> otherwise I can not reproduce it. Did you run it between your tests?

Yes. I did. but gs still fails without fontawesome-fonts-web.

> Also, I believe the issue is that fontawesome-fonts-web contains a .woff
> file, which is what breaks it all. Maybe you have some other .woff file in
> /usr/share/fonts?

No. no woff fonts installed other than it.

Comment 12 Rik Theys 2018-11-30 11:52:56 UTC
Hi,

I've been trying to reproduce it in a container so you can reproduce my issue. Doing this I've discovered that this fontawesome-fonts package history is painful.

At some point fontawesome-fonts{,-web} was not in RHEL, so it was added to EPEL as 4.1.0-1. Since the woff files were needed to build some -doc packages, the version in EPEL was updated to 4.1.0-2 to include the woff files.

We synchronized that 4.1.0-2 version to our local repo, and that's what our clients install.

When building the container with EPEL enabled I noticed that the package was no longer in EPEL.

It seems that in RHEL 7.x, the package was added to RHEL but version 4.1.0-1 (without the woff file). Our systems did not downgrade to this version as it's older. Since EPEL can not replace packages from RHEL, they removed it from EPEL.

In RHBA-2018:3217, RHEL has now updated their package, but _also_ versioned it 4.1.0-2, which means systems that once had it from EPEL will still not replace it with this version. In this version they include the .woff file.

By installing this version, I can also reproduce the issue in the container.

My Dockerfile:

FROM centos:centos7
RUN yum --enablerepo cr -y update ; yum -y --enablerepo cr install freetype fontconfig ghostscript
RUN yum --enablerepo cr -y install fontawesome-fonts-web ; yum clean all
CMD ["/bin/bash"]


[root@lucifer e]# podman run -it localhost/bug
[root@1b565efb580b /]# rpm -q fontawesome-fonts-web ghostscript freetype fontconfig
fontawesome-fonts-web-4.1.0-2.el7.noarch
ghostscript-9.07-31.el7.x86_64
freetype-2.8-12.el7.x86_64
fontconfig-2.13.0-4.3.el7.x86_64
[root@1b565efb580b /]# gs -sDEVICE=jpeg
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Error: /typecheck in /findfont
Operand stack:
   Times-Roman
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   1836   1   3   %oparray_pop
Dictionary stack:
   --dict:1164/1684(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Current file position is 22
GS<1>


When I remove the font package from the container, it works:


[root@1b565efb580b /]# rpm -e fontawesome-fonts-web-4.1.0-2.el7.noarch
[root@1b565efb580b /]# fc-list |grep -i awesome
/usr/share/fonts/fontawesome/FontAwesome.otf: FontAwesome:style=Regular
/usr/share/fonts/fontawesome/fontawesome-webfont.ttf: FontAwesome:style=Regular
[root@1b565efb580b /]# gs -sDEVICE=jpeg
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 3551552 2099425 4126524 2827072 1 done.
GS<1>

If I install the 4.1.0-1 package, it also works as the .woff file is not included in that package:

[root@1b565efb580b /]# fc-list |grep -i awesome
/usr/share/fonts/fontawesome/FontAwesome.otf: FontAwesome:style=Regular
/usr/share/fonts/fontawesome/fontawesome-webfont.ttf: FontAwesome:style=Regular
[root@1b565efb580b /]# rpm -q fontawesome-fonts-web
fontawesome-fonts-web-4.1.0-1.el7.noarch
[root@1b565efb580b /]# gs -sDEVICE=jpeg
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.
GS>/Times-Roman findfont
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Can't find (or can't open) font file /usr/share/ghostscript/9.07/Resource/Font/NimbusRomNo9L-Regu.
Can't find (or can't open) font file NimbusRomNo9L-Regu.
Querying operating system for font files...
Loading NimbusRomNo9L-Regu font from /usr/share/fonts/default/Type1/n021003l.pfb... 3551552 2099425 4126524 2827072 1 done.


I hope you will be able to reproduce the issue by building a container using the above dockerfile.

Regards,
Rik

Comment 13 Akira TAGOH 2018-12-03 06:57:03 UTC
This is a ghostscript bug. they try to open WOFF fonts even if they don't support it. see https://bugs.ghostscript.com/show_bug.cgi?id=695031

and http://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=f4584b0e fixes this issue as mentioned there. reassigning.

Comment 14 Martin Osvald 🛹 2018-12-03 08:52:29 UTC
Created attachment 1510834 [details]
backported patch

TEMPORARY WORKAROUND:

- apply the attached backported patch:

~~~
# patch -d /usr/share/ghostscript/9.07/Resource/Init/ < bz1653706.patch
~~~

Note: You can revert the patch any time by running the same patch command again:

~~~
# patch -d /usr/share/ghostscript/9.07/Resource/Init/ < bz1653706.patch
patching file gs_fonts.ps
Reversed (or previously applied) patch detected!  Assume -R? [n] y
#
~~~

Comment 15 Martin Osvald 🛹 2018-12-03 08:55:12 UTC
removing keyword Regression, this behavior was in Ghostscript 9.07 already

Comment 16 Martin Osvald 🛹 2018-12-03 08:57:50 UTC
Hello Rik,

please, could you test the steps from comment 14, whether they fix your problem?

Thank you and regards,
-Martin

Comment 17 Rik Theys 2018-12-03 09:14:25 UTC
Hi Martin,

I've tested the patch and I can confirm it works with the patch applied.

Regards,
Rik

Comment 18 Martin Osvald 🛹 2018-12-03 09:23:40 UTC
(In reply to Rik Theys from comment #17)
> I've tested the patch and I can confirm it works with the patch applied.

Thanks a lot for testing it so quickly!

I will try to get it into RHEL7.7.

Comment 19 Rik Theys 2018-12-03 09:27:35 UTC
Hi,

Is it possible to also have it fixed in 7.6?

Rik

Comment 20 Martin Osvald 🛹 2018-12-03 09:45:11 UTC
> Is it possible to also have it fixed in 7.6?

I am sorry, but I am not the one who decides whether it will get to RHEL7.6.z, but our Product Management.

Currently, from what I see it doesn't meet the criteria for inclusion in 7.6.z, because it is not a security-related problem, has no customer attached case and has a temporary workaround.

In case you have an active RHEL subscription I would recommend to contact our support to create a support case and share a Business Impact. This can help with getting this fixed in 7.6.z.

Comment 21 Rik Theys 2018-12-03 19:49:00 UTC
Hi Martin,

It seems a ghostscript update will be released for bug 165404 (tagged urgent, regression)? Would you mind checking if it's possible to include the fix for this bug in that upload?

Regards,
Rik

Comment 22 Martin Osvald 🛹 2018-12-04 06:36:29 UTC
(In reply to Rik Theys from comment #21)
> It seems a ghostscript update will be released for bug 165404 (tagged
> urgent, regression)? Would you mind checking if it's possible to include the
> fix for this bug in that upload?

Hi Rik,

that isn't/wasn't possible even if this BZ had all the ACKs granted (pm,dev,qa,rhel-7.6.z) due to the nature of the release process (time needed for QA and tests) - ghostscript-9.07-31.el7_6.3 was released just today.

Again, for this to be included in any later releases for 7.6.z it would need to have all the mentioned ACKs granted and for this, it needs to meet the criteria for inclusion mentioned in comment 20. If this had a customer case attached with a Business Impact, it would be much easier to get them.

With everything being said I will keep this on my radar and if anything changes, I will be more than happy to fix this. I am sorry for any inconvenience, but I have a limited ability to influence what will get fixed and when.

Comment 23 Akira TAGOH 2018-12-20 02:54:25 UTC
*** Bug 1660610 has been marked as a duplicate of this bug. ***

Comment 30 errata-xmlrpc 2019-08-06 13:12:44 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2281


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