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

 
 

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

Submitter:  Rik <rik5>
Submitted:  Tue 07 Jan 2014 07:48:38 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 3.8.0 Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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.


octave:26> print -deps fltk.eps
octave:27> print -depswrite fltk.eps
octave:28> print -deps2write fltk.eps
Unknown device: eps2write
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice
octave:29> print -dfoobar fltk.eps
Unknown device: foobar
Unrecoverable error: undefined in .uninstallpagedevice
Operand stack:
    defaultdevice


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


## eps, epsc, eps2, epsc2 are not included here because those are
## are generated by the graphics toolkit.


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>
Group 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:
http://www.ghostscript.com/doc/current/History9.htm#Version9.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>
Group 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.


PS2 writer

The ps2write device outputs postscript language levels 2 and 3. Please refer to Ps2ps2.htm for the ps2write device options. It is recommnded that this device is used for PostScript output, unless level 1 PostScript is required in which case you must use the epswrite device below.

EPS writer

The epswrite device outputs encapsulated postscript. This device is now deprecated and should only be used when level 1 PostScript output is required.


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


./plot/util/private/__print_parse_opts__.m:302:  if (strcmp (arg_st.devopt, "pswrite"))
./plot/util/private/__print_parse_opts__.m:402:%! assert (opts.devopt, "pswrite");
./plot/util/private/__print_parse_opts__.m:406:%! assert (opts.ghostscript.device, "pswrite");
./plot/util/private/__print_parse_opts__.m:414:%! assert (opts.devopt, "pswrite");
./plot/util/private/__print_parse_opts__.m:418:%! assert (opts.ghostscript.device, "pswrite");
./plot/util/private/__print_parse_opts__.m:647:  aliases.ps = "pswrite";
./plot/util/private/__print_parse_opts__.m:649:  aliases.psc = "pswrite";



Rik <rik5>
Group administrator

 

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

Attach Files:
   
   
Comment:
   

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

 

Depends on the following items: None found

Digest:
   bug dependencies.

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-01-12 rik5 Open/ClosedOpen Closed
    2015-01-12 rik5 StatusNeed Info Fixed
    2014-10-28 rik5 Attached File- Added print.diffs, #32330
        Carbon-Copy- Added bpabbott
    2014-10-27 rik5 StatusNone Need Info
    2014-10-24 omsai Attached File- Added ghostscript-deprecation-fixes.patch, #32317
    2014-06-15 rik5 Dependencies- bugs #42553 is dependent

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code