Bug 1654045 - ghostscript update breaks xdvi (gs: Error: /undefined in flushpage)
Summary: ghostscript update breaks xdvi (gs: Error: /undefined in flushpage)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: ghostscript
Version: 7.6
Hardware: All
OS: Linux
urgent
medium
Target Milestone: rc
: ---
Assignee: Martin Osvald 🛹
QA Contact: Petr Sklenar
URL:
Whiteboard:
Depends On:
Blocks: 1654290
TreeView+ depends on / blocked
 
Reported: 2018-11-27 22:23 UTC by Orion Poplawski
Modified: 2019-08-06 13:12 UTC (History)
4 users (show)

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


Attachments (Terms of Use)
temporary workaround patch (1.25 KB, patch)
2018-11-28 04:24 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 Orion Poplawski 2018-11-27 22:23:27 UTC
Description of problem:

ghostscript-9.07-31.el7_6.1 removes flushpage which xdvi uses.  xdvi now cannot render files with embedded postscript images:

gs: Error: /undefined in flushpage

Version-Release number of selected component (if applicable):
ghostscript-9.07-31.el7_6.1.x86_64
texlive-xdvi-bin-svn26509.0-43.20130427_r30134.el7.x86_64

See also bug #1518131 - which appears to have been addressed by restoring the flushpage operator.

Comment 2 Orion Poplawski 2018-11-27 22:28:33 UTC
One can also work around this by editing /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps and removing /flushpage from the list on line 2127.

Comment 3 Martin Osvald 🛹 2018-11-28 03:46:00 UTC
Hello,

thank you very much for reporting this problem!

I can reproduce by following the steps from the link mentioned in the Fedora bug 1518131:

https://bugs.archlinux.org/task/56284

~~~
copy /usr/share/ghostscript/9.22/examples/tiger.eps and the attached gs-test.tex to working directory
latex gs-test
xdvi gs-test
~~~~

results:

~~~
$ xdvi gs-test
xdvi-xaw: Warning: could not find dvips map file psfonts.map; skipping

Warning: Missing charsets in String to FontSet conversion
gs: Error: /undefined in flushpage
gs: Operand stack:
gs: 
gs: Execution stack:
gs:    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--
gs:    2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fals
gs: e   1   %stopped_push   1884   1   3   %oparray_pop   1883   1   3   %oparray_pop
gs:    1867   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   
gs: %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval-- 
gs:   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nost
gs: ringval--
gs: Dictionary stack:
gs:    --dict:956/1684(ro)(G)--   --dict:0/20(G)--   --dict:81/200(L)--
gs: Current allocation mode is local
gs: Last OS error: No such file or directory
gs: GPL Ghostscript 9.07: Unrecoverable error, exit code 1
$
~~~

Kind regards,
-Martin

Comment 7 Martin Osvald 🛹 2018-11-28 04:21:24 UTC
TEMPORARY WORKAROUND (in addition to comment 2):

- remove the "flushpage" string from the line 2127 in /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps

or

- apply the attached patch:

~~~
# cat temp-workaround.patch
diff -up /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps.BZ1654045 /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps
--- /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps.BZ1654045      2018-11-28 05:06:01.811507935 +0100
+++ /usr/share/ghostscript/9.07/Resource/Init/gs_init.ps        2018-11-28 05:06:19.079809703 +0100
@@ -2124,7 +2124,7 @@ SAFER { .setsafe } if
 /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
 /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
 /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
-/.devicename /.doneshowpage /flushpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
+/.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
 /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
 /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
 /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
#

# patch -d /usr/share/ghostscript/9.07/Resource/Init/ < temp-workaround.patch 
patching file gs_init.ps
#
~~~

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

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

Comment 8 Martin Osvald 🛹 2018-11-28 04:24:02 UTC
Created attachment 1509352 [details]
temporary workaround patch

temporary workaround patch

Please, see comment 7 for more details on how to apply it.

Comment 11 Martin Osvald 🛹 2018-11-28 06:39:49 UTC
Upstream patch:

PS interpreter - restore the flushpage operator

https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=19ebb5f1f497b6f2d50fe13d17d3e627dfb6c868


Fix for this in Fedora 27:

spec file:

~~~
 326 * Wed Nov 29 2017 Tom Callaway <spot@fedoraproject.org> - 9.22-2
 327 - apply post 9.22 upstream commit to restore flushpage operator (xdvi needs it)
~~~

patch:

~~~
$ cat ghostscript-9.22-restore-flushpage.patch
diff -up ghostscript-9.22/Resource/Init/gs_init.ps.restore-flushpage ghostscript-9.22/Resource/Init/gs_init.ps
--- ghostscript-9.22/Resource/Init/gs_init.ps.restore-flushpage 2017-11-29 14:58:35.449534983 -0500
+++ ghostscript-9.22/Resource/Init/gs_init.ps   2017-11-29 14:59:25.903397616 -0500
@@ -2163,7 +2163,7 @@ SAFER { .setsafeglobal } if
 /.type1execchar /.type2execchar /.type42execchar /.setweightvector /.getuseciecolor /processcolors /.includecolorspace
 /.execn /.instopped /.stop /.stopped /.setcolorrendering /.setdevicecolorrendering /.buildcolorrendering1 /.builddevicecolorrendering1
 /.TransformPQR_scale_WB0 /.TransformPQR_scale_WB1 /.TransformPQR_scale_WB2 /.currentoverprintmode /.copydevice2
-/.devicename /.doneshowpage /flushpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
+/.devicename /.doneshowpage /.getbitsrect /.getdevice /.getdefaultdevice /.getdeviceparams /.gethardwareparams
 /makewordimagedevice /.outputpage /.putdeviceparams /.setdevice /.currentshowpagecount
 /.setpagedevice /.currentpagedevice /.knownundef /.setmaxlength /.rectappend /.initialize_dsc_parser /.parse_dsc_comments
 /.fillCIDMap /.fillIdentityCIDMap /.buildcmap /.filenamelistseparator /.libfile /.getfilename
@@ -2181,6 +2181,15 @@ SAFER { .setsafeglobal } if
 /.systemvmSFD /.settrapparams /.currentsystemparams /.currentuserparams /.getsystemparam /.getuserparam /.setsystemparams /.setuserparams
 /.checkpassword /.locale_to_utf8 /.currentglobal /.gcheck /.imagepath
 
+% Used by a free user in the Library of Congress. Apparently this is used to
+% draw a partial page, which is then filled in by the results of a barcode
+% scanner and SQL database lookup. Its not clear to us exactly why this needs to be
+% done as a partial page, but its easiest to restore the operator, and it seems like
+% its a reasonably safe operator to restore, for the *very* few devices on which
+% it will have any effect. Currently this uses the 'sync_outptu' device method
+% to transfer the partial page, in future we may use a spec_op instead.
+%/flushpage
+
 % Used by our own test suite files
 %/.fileposition %image-qa.ps
 %/.makeoperator /.setCPSImode % gs_cet.ps
$
~~~

Comment 21 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.