Bug 57291 - KGhostview fails to display ps or pdf files (error while opening)
Summary: KGhostview fails to display ps or pdf files (error while opening)
Status: RESOLVED WORKSFORME
Alias: None
Product: kghostview
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Wilco Greven
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-15 23:00 UTC by thst
Modified: 2003-05-06 13:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thst 2003-04-15 23:00:50 UTC
Version:           0.20 KDE 3.1.90 (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 2.95.3 
OS:          Linux

If I try to open any file using kghostview, it will fail to open the file. 

I am using gs 7.00 and if i call gs on the file on the commandline everything is fine. kghostview displays the following output and then a requester "failed to open..."

thst@server:~ > kghostview rechnung1.pdf
kio (KDirWatch): Available methods: Stat, DNotify
kghostview (kdegraphics): KGVConfigDialog::readSettings
kghostview (kdegraphics): KPSWidget::stopInterpreter()
kghostview (kdegraphics): KPSWidget::stopInterpreter()
kghostview (kdegraphics): DisplayOptions::setMagnification(1)
kghostview (kdegraphics): DisplayOptions::setMagnification(1): nearest allowed magnification: 1
kparts: MainWindow::createGUI, part=0x80e4a28 KGVPart kgvpart
kghostview (kdegraphics): KPSWidget::stopInterpreter()
kghostview (kdegraphics): DisplayOptions::setMagnification(1)
kghostview (kdegraphics): DisplayOptions::setMagnification(1): nearest allowed magnification: 1
kghostview (kdegraphics): DisplayOptions::setMagnification(1)
kghostview (kdegraphics): DisplayOptions::setMagnification(1): nearest allowed magnification: 1
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-thst/ksycoca
kghostview (kdegraphics): KGVRun::foundMimeType( application/pdf )
kghostview (kdegraphics): KGVPart::slotMimetype: type=application/pdf
kghostview (kdegraphics): KGVDocument::openFile
kghostview (kdegraphics): Pdf2dsc: started
Error: /undefined in .locksafe
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1007/1123(ro)(G)--   --dict:0/20(G)--   --dict:66/200(L)--
Current allocation mode is local
Last OS error: 2
AFPL Ghostscript 7.00: Unrecoverable error, exit code 1
kghostview (kdegraphics): Pdf2dsc: process exited
kghostview (kdegraphics): KGVDocument::openPDFFileContinue
Comment 1 Luís Pedro Coelho 2003-04-16 00:47:09 UTC
I can confirm this. The problem is on doing the PDF->DSC convertion, which runs 
the following command:  
  
gs "-dSAFER" "-dPARANOIDSAFER" "-dDELAYSAFER" "-dNODISPLAY"  
"-dQUIET" "-sPDFname=rechnung.pdf" "-sDSCname=rechnung.dsc" "-c" "<<  
/PermitFileReading [ PDFname ] /PermitFileWriting [ DSCname ] /PermitFileControl []  
>> setuserparams .locksafe" "-f" "pdf2dsc.ps" "-c" "quit"  
  
On my system, it works on GNU gs 7.05 and it fails on GNU gs 6.52. The reporter is 
using AFPL gs which is a previous version to gnu-gs 7.05. 
 
I am CCing Waldo since this is his code and I think he would be better prepared to  
answer questions about this. 
Comment 2 Waldo Bastian 2003-04-16 10:41:00 UTC
Seems like this version of GS doesn't know .locksafe 
 
Does it work if you copy the version of .locksafe inside gs_init.ps from your 7.0.5 
version to 6.52 ? 
 
Comment 3 Luís Pedro Coelho 2003-04-16 11:12:37 UTC
Subject: Re:  KGhostview fails to display ps or pdf files (error while opening)

Le Mercredi 16 Avril 2003 10:41, Waldo Bastian a 
Comment 4 Waldo Bastian 2003-04-16 21:11:41 UTC
I got confirmation that .locksafe has been introduced in 6.53 (for 6.x) resp 7.04 (for 
7.x) So if you are using AFPL gs 7.00 I recommend that you upgrade to at least 
AFPL gs 7.04. See http://www.ghostscript.com/article/23.html 
Comment 5 thst 2003-04-16 22:37:37 UTC
I installed gs 7.04 and kgv works again. 
 
Since Kghostview doesnt work at all if an older version of gs is installed, there 
should be a test in the programm code and in the configure script, telling the user to 
upgrade or use at own risk. 
 
So this could be converted into a feature-request :-) and works for me. Thanks! 
Comment 6 thst 2003-04-16 22:39:27 UTC
Works for me 
Comment 7 Waldo Bastian 2003-04-16 23:05:58 UTC
Yes, there should indeed be a test. I was under the mistaken assumption that 
.locksafe would be available on most versions :-( 
 
Comment 8 Luís Pedro Coelho 2003-04-17 00:52:26 UTC
Subject: Re:  KGhostview fails to display ps or pdf files (error while opening)

We already test for the version of gs to do some things. If Waldo or someone 
else can find the correct parameters for older gs's, I will put this in the 
version detection code as well. I do know kghostview's code but my knowledge 
of the postscript language is limited (understament), so I can't help there.

Still, I think this is a bug. We cannot just require users to upgrade 
ghostscript unless we conclude that is the only option. ghostscript is not 
just a program to display postscript files, but it is the base of the whole 
unix printing system and it is not really backward and foward compatible. 
Often you upgrade ghostscript and you must upgrade your whole printing system 
as well or at least change the whole settings. This is pretty messy.

Is it really impossible to implement something like this in gs 6.52? Can't we 
adapt the postscript code from .locksafe in gnu gs 7? How about falling back 
to -dSAFER without the paranoia setting? I really don't like the idea of 
rendering kghostview unusable on a lot of systems. I can't really help here, 
I know almost nothing about postscript.

I am tempted to reopen, but I will wait for Waldo's point of view. Even if a 
solution is not immediatelly obvious, I think we should reopen. In fact, if a 
solution is immediatelly obvious, we should fix it right now and leave it 
closed ;-)

Regards,
luis pedro

Comment 9 Axel Roebel 2003-05-06 13:37:45 UTC
I just compiled and installed kde3.1.1a. After this kghostview will no longer display 
any postscript files. Concerning pdf files it quits with a can not open file error. 
However, the same files display fine in ghostview/acroread. 
 
Is this related to the gs version I use. If so, would it not be a good idea to mark in the 
announcement that the supported versions of ghostscript have changed?? 
 
Kind regards. 
 
Comment 10 Luís Pedro Coelho 2003-05-06 13:45:57 UTC
There are two bugs with version 3.1.1a: one is that it doesn't really work - shows 
only one page or nothing - in some instalations of gs and is solved for 3.1.2 which 
is coming very soon (this is probably what you are seeing). 
The warning you are talking about  - we do not support real old versions anymore, 
true - will be in version 3.2 (we are careful about changing user-visible messages in 
stable versions not to break translations). 
 
If you are working from source you might check 
http://bugs.kde.org/show_bug.cgi?id=57441 for a patch   for the first bug. 
 
HTH,