Bug 610301 - Fontmap.local file created by package is never used
Fontmap.local file created by package is never used
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: ghostscript (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Tim Waugh
Fedora Extras Quality Assurance
:
: 630423 632042 (view as bug list)
Depends On:
Blocks: 629941 629943
  Show dependency treegraph
 
Reported: 2010-07-01 20:34 EDT by Mitchell Berger
Modified: 2010-10-25 11:51 EDT (History)
10 users (show)

See Also:
Fixed In Version: ghostscript-8.71-16.fc12
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 629941 629943 (view as bug list)
Environment:
Last Closed: 2010-10-11 15:25:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
runlibfileifexists patch from OpenSUSE (1.67 KB, patch)
2010-09-06 11:56 EDT, Edward Sheldrake
no flags Details | Diff

  None (edit)
Description Mitchell Berger 2010-07-01 20:34:42 EDT
Description of problem:
The spec file for the ghostscript package creates the following
three files in /etc/ghostscript/8.71:
  cidfmap.local
  CIDFnmap.local
  Fontmap.local

The files under /etc/ghostscript are important because they are
the only ones marked as %config(noreplace), and so if you make
customizations to the system-wide files in
/usr/share/ghostscript/8.71/Resource/Init, they may be clobbered
if the upstream version of the file changes.

The system-wide cidfmap and CIDFnmap files contain lines like
these at the end:

% must be at the bottom of line to allow people overriding everything.
(cidfmap.local) .runlibfileifexists

% must be at the bottom of line to allow people overriding everything.
(CIDFnmap.local) .runlibfileifexists

No such line exists at the end of the global Fontmap file.  As a
result, making customizations in the obvious place (the
/etc/ghostscript/8.71/Fontmap.local file that the package helpfully
creates for you) results in your customizations never being read
in by gs.

Version-Release number of selected component (if applicable):
8.71-6.fc11.x86_64, 8.71-9.fc13.x86_64, and presumably also the
current versions in F12 and Rawhide

Steps to Reproduce:
1. yum install ghostscript strace
2. strace gs >/tmp/gstrace 2>&1
3. search for Fontmap in /tmp/gstrace with your favorite editor
   and note that several locations including /etc/ghostscript and
   /etc/ghostscript/8.71 are searched for a file called Fontmap,
   but Fontmap.local is never tried
  
One way to tackle this would be to patch the upstream Fontmap
file to add something like this to the end of the global file:
(Fontmap.local) .runlibfileifexists
I recommend this solution.

Another approach would be to discontinue creating the
/etc/ghostscript/8.71/Fontmap.local file and instead create
one named Fontmap.  However, all systems with ghostscript
already installed may still have the Fontmap.local file present
and be confused when they try to use it.
Comment 1 Tim Waugh 2010-09-03 06:58:04 EDT
The patch to get ghostscript to read Fontmap.local was dropped after ghostscript-8.15.4-3.fc7.  I think that was just a mistake at the time -- those files were reorganised upstream.

Thanks for reporting it.
Comment 2 Fedora Update System 2010-09-03 10:06:02 EDT
ghostscript-8.71-15.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/ghostscript-8.71-15.fc12
Comment 3 Fedora Update System 2010-09-03 10:06:53 EDT
ghostscript-8.71-14.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/ghostscript-8.71-14.fc13
Comment 4 Fedora Update System 2010-09-03 10:07:56 EDT
ghostscript-8.71-15.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/ghostscript-8.71-15.fc14
Comment 5 Fedora Update System 2010-09-03 12:43:55 EDT
ghostscript-8.71-15.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update ghostscript'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/ghostscript-8.71-15.fc14
Comment 6 Henry Kroll 2010-09-04 23:51:25 EDT
Ghostscript-8.71-15.fc14 won't print anymore in Rawhide.

$ /usr/lib/cups/filter/pstoraster
Fontmap entry for Fontmap.local ends prematurely!  Giving up.

It DOES work, however, if you change

(CIDFnmap.local) .runlibfileifexists
to
(Fontmap.local) .runlibfile

in /usr/share/ghostscript/8.71/Resource/Init/Fontmap

or remove the line entirely.
Comment 7 Henry Kroll 2010-09-04 23:52:05 EDT
I mean change (Fontmap.local) .runlibfileifexists to (Fontmap.local) .runlibfile
Comment 8 Horst H. von Brand 2010-09-05 12:42:23 EDT
(In reply to comment #6)
> Ghostscript-8.71-15.fc14 won't print anymore in Rawhide.
> 
> $ /usr/lib/cups/filter/pstoraster
> Fontmap entry for Fontmap.local ends prematurely!  Giving up.
> 
> It DOES work, however, if you change
> 
> (CIDFnmap.local) .runlibfileifexists
> to
> (Fontmap.local) .runlibfile
> 
> in /usr/share/ghostscript/8.71/Resource/Init/Fontmap
> 
> or remove the line entirely.

For me "asy -tex pdflatex xxx.asy" failed as above, fixed by commenting out the mentioned line.

AFAIU, the message means that the file is tuncated, i.e., just an empty file won't do. If it is shipped/used, it should be correct.
Comment 9 Edward Sheldrake 2010-09-06 11:56:29 EDT
Created attachment 443320 [details]
runlibfileifexists patch from OpenSUSE

I don't think the current runlibfileifexists patch in Fedora actually works due to the way fontmap files are loaded by gs_fonts.ps.

I found OpenSUSE's runlibfileifexists patch also modifies gs_fonts.ps to handle fontmap files that use runlibfileifexists.

http://www.mirrorservice.org/sites/download.opensuse.org/update/11.3/rpm/src/ghostscript-library-8.70-15.1.1.src.rpm/ghostscript-8.60-runlibfileifexists.dif?extract=true
Comment 10 David 2010-09-07 03:59:45 EDT
This wont print in FC13 either:

ghostscript           i686      8.71-15.fc13        updates-testing      4.5 M
ghostscript-cups      i686      8.71-15.fc13        updates-testing       44 k

I found another bugzilla on this:

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

Maybe someone merge these bugs?
Comment 11 jd1008 2010-09-07 20:32:16 EDT
On F13, I  have

ghostscript.i686         8.71-15.fc13 @updates-testing                          
ghostscript-cups.i686    8.71-15.fc13 @updates-testing                          
ghostscript-devel.i686   8.71-15.fc13 @updates-testing                          
ghostscript-fonts.noarch 5.50-23.fc12 @anaconda-InstallationRepo-200911081854.i386/12

I ran

$ gs -q -dNOPAUSE -dNODISPLAY -dBATCH -dDELAYBIND -g2448x3168 -r288 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -c 0 0 translate -sTraceFile=/sdb3/home/jd/.scribus//ps.out -sExportFiles=/tmp/Document--XXX /usr/lib/scribus/import.prolog /tmp/XXX.pdf -c flush cfile closefile quit 

Fontmap entry for Fontmap.local ends prematurely!  Giving up.

So, even with the latest patches in 8.71-15, the bug remains.

FYI:

$ ls -l  /etc/ghostscript/8.71/Fontmap.local
-rw-r--r-- 1 root root 0 Sep  3 05:06 /etc/ghostscript/8.71/Fontmap.local

Zero length file. Why so??
The updates were installed a few days ago.
Comment 12 Joachim Frieben 2010-09-10 00:59:15 EDT
This is probably wrong (ghostscript-8.71-15.fc14):

> ls -l /etc/ghostscript/8.71/
total 0
-rw-r--r--. 1 root root 0 Sep  3 14:15 cidfmap.local
-rw-r--r--. 1 root root 0 Sep  3 14:15 CIDFnmap.local
-rw-r--r--. 1 root root 0 Sep  3 14:15 Fontmap.local
Comment 13 Adam Tkac 2010-09-13 05:13:47 EDT
Fix for this issue breaks also /usr/bin/ps2pdf command and it's currently impossible to build nasm package. When I revert from ghostscript-8.71-15.fc15 to ghostscript-8.71-14.fc15 everything is OK. Fix suggested in comment #6 also helps.
Comment 14 Tim Waugh 2010-09-13 10:15:30 EDT
*** Bug 630423 has been marked as a duplicate of this bug. ***
Comment 15 Tim Waugh 2010-09-13 11:21:36 EDT
*** Bug 632042 has been marked as a duplicate of this bug. ***
Comment 16 Fedora Update System 2010-09-13 12:52:20 EDT
ghostscript-8.71-16.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/ghostscript-8.71-16.fc14
Comment 17 Fedora Update System 2010-09-13 12:55:21 EDT
ghostscript-8.71-16.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/ghostscript-8.71-16.fc13
Comment 18 Fedora Update System 2010-09-13 12:56:55 EDT
ghostscript-8.71-16.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/ghostscript-8.71-16.fc12
Comment 19 Tim Waugh 2010-09-13 13:16:06 EDT
(In reply to comment #9)
> I don't think the current runlibfileifexists patch in Fedora actually works due
> to the way fontmap files are loaded by gs_fonts.ps.
> 
> I found OpenSUSE's runlibfileifexists patch also modifies gs_fonts.ps to handle
> fontmap files that use runlibfileifexists.

Thanks Edward, I think you hit the nail on the head there.  I've included the extra part of the patch in these respun packages.
Comment 20 Steven Haigh 2010-09-13 22:24:32 EDT
New packages work for me in F14.
Comment 21 jd1008 2010-10-09 22:54:27 EDT
(In reply to comment #17)
> ghostscript-8.71-16.fc13 has been submitted as an update for Fedora 13.
> https://admin.fedoraproject.org/updates/ghostscript-8.71-16.fc13

I confirm that it is fixed in F13.
Thanx all!
Comment 22 Fedora Update System 2010-10-11 15:25:26 EDT
ghostscript-8.71-16.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 23 Fedora Update System 2010-10-11 23:13:14 EDT
ghostscript-8.71-16.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 24 Fedora Update System 2010-10-14 19:01:26 EDT
ghostscript-8.71-16.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 25 Alan Stern 2010-10-22 16:45:19 EDT
In ghostscript-8.71-16.fc12 the "file" command no longer works correctly if -dSAFER is set.  I haven't tried using it much lately, so the problem may have crept in one or two releases earlier.

Example showing the problem:

[stern@iolanthe PS]$ rpm -qf `which gs`
ghostscript-8.71-16.fc12.i686
[stern@iolanthe PS]$ ls -l spiral.ps
-rw-rw-r-- 1 stern stern 2854 1999-03-02 14:50 spiral.ps

[stern@iolanthe PS]$ gs 
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>(spiral.ps) (r) file
GS<1>^C

[stern@iolanthe PS]$ gs -dSAFER
GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
GS>(spiral.ps) (r) file
Error: /invalidfileaccess in --file--
Operand stack:
   (spiral.ps)   (r)
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--
Dictionary stack:
   --dict:1150/1684(ro)(G)--   --dict:0/20(G)--   --dict:70/200(L)--
Current allocation mode is local
Last OS error: 11
Current file position is 21
GS<2>^C
Comment 26 Tim Waugh 2010-10-25 07:35:44 EDT
Ah, that might be the cause of bug #642427.
Comment 27 Alan Stern 2010-10-25 10:20:34 EDT
Yes, it looks that way.  I originally ran across this problem in a similar setting; a "run" command that had worked previously now fails.

Over the weekend I found an old copy of the 8.71-7 release.  It did not have this problem.  I don't know where to find any intermediate releases, but probably you can test them just as easily as I can.
Comment 28 Tim Waugh 2010-10-25 11:51:37 EDT
The cause is that we use a different (more secure) build default in ghostscript now which is equivalent to the command line option "-P-".  To allow reading files from the current directory, use the command line option "-P" (or "-I.").

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