bugGNU Octave - Bugs: bug #41141, pswrite device removed from...


bug #41141: pswrite device removed from Ghostscript (print scripts need updating)

Submitted by:  Rik <rik5>
Submitted on:  Tue 07 Jan 2014 07:48:38 PM UTC  
Category: PlottingSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: 3.8.0Operating System: Microsoft Windows

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 12 Jan 2015 04:48:08 PM UTC, comment #5:

I checked in a change to the gui-release branch which updates Octave to use the ps2write device. This seems fairly safe as the device was introduced in 2010. I did not make the corresponding change for the eps2write device because this device was only introduced in 2014 and there are potentially a lot of installation environments which will not have access to it.

Changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/6a9bde1ba0ea).

Rik <rik5>
Project Administrator
Tue 28 Oct 2014 04:20:54 PM UTC, comment #4:

This may be a little more involved than I thought. I'm adding Ben Abbott to the CC list since he understands this more than I do.

At least for the FLTK toolkit, the "printing" is done by gl2ps which can produce eps output. I think what happens is that if you print with a default format that gl2ps supports, like ps or pdf, then it generates it directly. Only if you call for an output which it doesn't support will it invoke Ghostscript. In this case it first calls gl2ps to create postscript and then calls Ghostscript to change that input into something else. I'm running Ghostscript 9.05 which doesn't have the eps2write device. With your patch installed, I only get an error if I use a device I don't have.

I think there is another clue in the bottom of _print_parse_opts_.m in the function gs_aliases()

Indeed, for gnuplot printing the same thing seems to apply. Any postscript/eps output is generated by gnuplot itself. It's only if we need to change the output to some other format is Ghostscript invoked.

I'm uploading a new patch based on yours which changes two things. First, In _gnuplot_print_ there was still an if/then changing the Postscript level to 1 when 'eps' or 'epsc' was used. Second, in _print_parse_opts_.m the number of file suffixes was bigger than the number of devices because pswrite was deleted. So I deleted the suffix that was supposed to match up with the pswrite device.

(file #32330)

Rik <rik5>
Project Administrator
Tue 28 Oct 2014 12:44:03 PM UTC, comment #3:

epswrite support on older systems is pertinent since eps2write was only introduced recently in Ghostscript 9.14:

I tested the patch on my system which does not have eps2write device and it worked. I verified that my Ghostscript 9.10 has epswrite and not eps2write by looking at the output of `gs -h'. With the patch, saving an .eps plot from octave command line works and without the patch it does not. I admit I had not been thorough to find out why it works, and investigate within the next 3 days.

Pariksheet Nanda <omsai>
Mon 27 Oct 2014 03:52:23 PM UTC, comment #2:

@Pariksheet: The ps2write engine has been available in ghostscript since 2010 so I don't have a problem changing pswrite to ps2write. When was the eps2write engine added to ghostscript? I see that the deprecation happened with the 9.14 release in April, 2014. Given that people may be building Octave on older systems for a few years, I only want to remove epswrite if there was a replacement eps2write available in earlier versions.

Rik <rik5>
Project Administrator
Fri 24 Oct 2014 01:00:51 PM UTC, comment #1:

> The fix seems relatively easy, to replace pswrite with ps2write or epswrite if version 1 conformance is required.

Indeed, although now epswrite has also been deprecated in ghostscript 9.14 in favor of eps2write.

The attached patch thus migrates to both ps2write and eps2write and has been tested against ghostscript 9.10 and octave 3.8.2.

(file #32317)

Pariksheet Nanda <omsai>
Tue 07 Jan 2014 07:48:38 PM UTC, original submission:

The pswrite device in Ghostscript has been deprecated since 12/15/2010. In Ghostscript versions >= 9.09 it is no longer even compiled in by default. This is a problem for Octave because the default device when the extension is .ps is pswrite.

The fix seems relatively easy, to replace pswrite with ps2write or epswrite if version 1 conformance is required.

The following documentation was taken from http://ghostscript.com/doc/current/Devices.htm.

I grepped through the m-files for pswrite and then condensed the list to the instances that would need changing. They are

Rik <rik5>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #32330:  print.diffs added by rik5 (7KiB - application/octet-stream)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -unavailable- added by rik5
  • -unavailable- added by omsai (Updated the item)
  • -unavailable- added by rik5 (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 12 Jan 2015 05:21:17 PM UTCrik5Open/ClosedOpen=>Closed
    Mon 12 Jan 2015 04:48:08 PM UTCrik5StatusNeed Info=>Fixed
    Tue 28 Oct 2014 04:20:54 PM UTCrik5Attached File-=>Added print.diffs, #32330
      Carbon-Copy-=>Added bpabbott
    Mon 27 Oct 2014 03:52:23 PM UTCrik5StatusNone=>Need Info
    Fri 24 Oct 2014 01:00:51 PM UTComsaiAttached File-=>Added ghostscript-deprecation-fixes.patch, #32317
    Sun 15 Jun 2014 04:57:08 AM UTCrik5Dependencies-=>bugs #42553 is dependent

    Back to the top

    Powered by Savane 3.1-cleanup1