Kemp’s Blog

A technical blog about technical things

xfig cannot import eps files

It seems that under Natty and Oneiric, xfig is unable to import eps files. When importing an eps you will get an error message along the lines of the following:

ERROR from ghostscript:
Error: /invalidfileaccess in --run--
Operand stack:
   3 --nostringval-- (filename.eps) (r)

and then several more lines of information.

The Ubuntu team is almost making it too easy to find faults with their work, given that the same issue was identified and fixed in SUSE and Fedora around a year ago (taking 11 days and 9 days respectively to push out the patch). The problem was reported to the Ubuntu team 6 months ago and still has no resolution.

Anyway, bitterness aside, the way I’m working around this is to convert the eps to a fig first and then import that. First you have to install pstoedit:

sudo apt-get install pstoedit

Now you can perform the conversion in this way:

pstoedit -f fig filename.eps > filename.fig

(Command found here.)

Update:

The suggestion in the bug report thread linked above seems to work correctly also. Starting xfig with the following parameters allows it to once again load eps files:

xfig -gh 'gs -dDELAYSAFER -sPermitFileReading="[ (*) ]" -dSAFER'

For some reason, this time round I also had to install the gsfonts-x11 package in order for xfig to be able to find any fonts. I can only assume that either it has been dropped as a prerequisite accidentally, or I always had something else installing it by coincidence.