Bug 1065720 - LyX crashes while inserting a pdf graphic
Summary: LyX crashes while inserting a pdf graphic
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: lyx
Version: 19
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rex Dieter
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-16 09:55 UTC by Paul Smith
Modified: 2014-04-27 09:09 UTC (History)
3 users (show)

Fixed In Version: lyx-2.1.0-0.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-04-27 09:06:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
The pdf file that causes the reported crash (5.06 KB, application/pdf)
2014-02-16 09:55 UTC, Paul Smith
no flags Details
The converted eps file (2.60 MB, application/postscript)
2014-04-17 09:14 UTC, Paul Smith
no flags Details

Description Paul Smith 2014-02-16 09:55:15 UTC
Created attachment 863679 [details]
The pdf file that causes the reported crash

When inserting the attached pdf file as a graphic into a LyX document, LyX crashes.

This pdf file was created with Mathematica 9.

Thanks in advance,

Paul

Comment 1 José Matos 2014-02-16 15:56:22 UTC
Works for me on Fedora 20 (both for lyx-2.0 and lyx-2.1 - to be).

In order to understand what could be the problem I have two requests:

1) If you run lyx from the command line as "lyx -dbg graphics", repeating the same procedure as before what is the last output?

2) What are the converters that you have defined for pdf?

Look for:
Tools->Preferences->File Handling->Converters

Pdf->...

Comment 2 Paul Smith 2014-02-16 18:46:55 UTC
Thanks, José. The answer to your request 1) is below.

Regarding request 2):
pdftops -eps -f 1 -l 1 $$i $$o

pdf2ps $$i $$o

-----------------
$ lyx -dbg graphics
Setting debug level to graphics
Debugging `graphics' (Graphics conversion and loading)
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (945): Recognised Fileformat: agr
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (945): Recognised Fileformat: pdf
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (832): filetools(getFormatFromContents)
	File type not recognised before EOF!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
FileName.cpp (950): filetools(getFormatFromContents)
	Couldn't find a known format!
Warning: Document class not available
----------------------------------------
The selected document class
	curriculum vitae (Europe)
requires external files that are not available.
The document class can still be used, but the
document cannot be compiled until the following
prerequisites are installed:
	europecv.cls
See section 3.1.2.2 (Class Availability) of the
User's Guide for more information.
insets/InsetGraphics.cpp (145): Token: '\end_inset'
filetools.cpp (1012): [readBB_from_PSFile] no(e)ps-format
GuiGraphics.cpp (346): [bb_Changed set to true]
GuiGraphics.cpp (346): [bb_Changed set to true]
GuiGraphics.cpp (346): [bb_Changed set to true]
GuiGraphics.cpp (346): [bb_Changed set to true]
insets/InsetGraphics.cpp (145): Token: 'filename'
insets/InsetGraphics.cpp (145): Token: '\end_inset'
FileName.cpp (945): Recognised Fileformat: pdf
graphics/GraphicsCacheItem.cpp (378): [CacheItem::Impl::convertToDisplayFormat]
	Attempting to convert image file: /home/psmith/testfile.pdf
	with displayed filename: ~/testfile.pdf
FileName.cpp (945): Recognised Fileformat: pdf
graphics/GraphicsCacheItem.cpp (385): 
	The file contains pdf format data.
GuiApplication.cpp (183): 
The image loader can load the following directly:

GuiApplication.cpp (190): BW, 
GuiApplication.cpp (190): EPS, 
GuiApplication.cpp (190): EPSF, 
GuiApplication.cpp (190): EPSI, 
GuiApplication.cpp (190): EXR, 
GuiApplication.cpp (190): PCX, 
GuiApplication.cpp (190): PSD, 
GuiApplication.cpp (190): RAS, 
GuiApplication.cpp (190): RGB, 
GuiApplication.cpp (190): RGBA, 
GuiApplication.cpp (190): SGI, 
GuiApplication.cpp (190): TGA, 
GuiApplication.cpp (190): XCF, 
GuiApplication.cpp (190): bmp, 
GuiApplication.cpp (190): bw, 
GuiApplication.cpp (190): dds, 
GuiApplication.cpp (190): eps, 
GuiApplication.cpp (190): epsf, 
GuiApplication.cpp (190): epsi, 
GuiApplication.cpp (190): exr, 
GuiApplication.cpp (190): gif, 
GuiApplication.cpp (190): ico, 
GuiApplication.cpp (190): jp2, 
GuiApplication.cpp (190): jpeg, 
GuiApplication.cpp (190): jpg, 
GuiApplication.cpp (190): mng, 
GuiApplication.cpp (190): pbm, 
GuiApplication.cpp (190): pcx, 
GuiApplication.cpp (190): pgm, 
GuiApplication.cpp (190): pic, 
GuiApplication.cpp (190): png, 
GuiApplication.cpp (190): ppm, 
GuiApplication.cpp (190): psd, 
GuiApplication.cpp (190): ras, 
GuiApplication.cpp (190): rgb, 
GuiApplication.cpp (190): rgba, 
GuiApplication.cpp (190): sgi, 
GuiApplication.cpp (190): svg, 
GuiApplication.cpp (190): svgz, 
GuiApplication.cpp (190): tga, 
GuiApplication.cpp (190): tif, 
GuiApplication.cpp (190): tiff, 
GuiApplication.cpp (190): webp, 
GuiApplication.cpp (190): xbm, 
GuiApplication.cpp (190): xcf, 
GuiApplication.cpp (190): xpm, 
GuiApplication.cpp (190): xv, 
graphics/GraphicsCache.cpp (91): LyX recognises the following image formats:
graphics/GraphicsCache.cpp (98): eps
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): bmp
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): eps
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): gif
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): jpg
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): jpg
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): pbm
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): pgm
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): png
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): ppm
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): svg
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): tiff
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): xbm
graphics/GraphicsCache.cpp (97): , 
graphics/GraphicsCache.cpp (98): xpm
graphics/GraphicsCache.cpp (100): 

graphics/GraphicsLoader.cpp (116): LoaderQueue: waking up
graphics/GraphicsLoader.cpp (90): LoaderQueue: 1 items in the queue
graphics/GraphicsCacheItem.cpp (408): 	Converting it to  format.
FileName.cpp (945): Recognised Fileformat: pdf
graphics/GraphicsCacheItem.cpp (378): [CacheItem::Impl::convertToDisplayFormat]
	Attempting to convert image file: /home/psmith/testfile.pdf
	with displayed filename: ~/testfile.pdf
FileName.cpp (945): Recognised Fileformat: pdf
graphics/GraphicsCacheItem.cpp (385): 
	The file contains pdf format data.
graphics/GraphicsConverter.cpp (127): Converter c-tor:
	from_file:      /home/psmith/testfile.pdf
	to_file_base: /tmp/lyx_tmpdir.hX3276/CacheItem.wZ3276
	from_format:  pdf
	to_format:    eps
graphics/GraphicsConverter.cpp (264): build_script ... 
graphics/GraphicsConverter.cpp (376): ready!
graphics/GraphicsConverter.cpp (142): 	Conversion script:
--------------------------------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, shutil, sys

def unlinkNoThrow(file):
  ''' remove a file, do not throw if an error occurs '''
  try:
    os.unlink(file)
  except:
    pass

infile = "/home/psmith/testfile.pdf"
outfile = "/tmp/lyx_tmpdir.hX3276/gconvert0.TT3276.pdf"
shutil.copy(infile, outfile)
os.chdir("/tmp/lyx_tmpdir.hX3276/")
infile = "/tmp/lyx_tmpdir.hX3276/gconvert0.TT3276.pdf"
infile_base = "/tmp/lyx_tmpdir.hX3276/gconvert0.TT3276"
outfile = "/tmp/lyx_tmpdir.hX3276/gconvert0.TT3276.eps"
outdir  = os.path.dirname(outfile)

if os.system(r'pdftops -eps -f 1 -l 1 ' + '"' + infile + '"' + ' ' + '"' + outfile + '"' + '') != 0:
  unlinkNoThrow(outfile)
  sys.exit(1)

if not os.path.isfile(outfile):
  if os.path.isfile(outfile + '.0'):
    os.rename(outfile + '.0', outfile)
    import glob
    for file in glob.glob(outfile + '.?'):
      unlinkNoThrow(file)
  else:
    sys.exit(1)

unlinkNoThrow(infile)

fromfile = outfile
tofile = "/tmp/lyx_tmpdir.hX3276/CacheItem.wZ3276.eps"

try:
  os.rename(fromfile, tofile)
except:
  try:
    shutil.copy(fromfile, tofile)
  except:
    sys.exit(1)
  unlinkNoThrow(fromfile)

--------------------------------------

ForkedCalls.cpp (495): ForkedCallQueue: waking up
graphics/GraphicsLoader.cpp (127): LoaderQueue: I'm going to sleep
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
ForkedCalls.cpp (504): ForkedCallQueue: I'm going to sleep
graphics/GraphicsCacheItem.cpp (263): Image conversion succeeded.
FileName.cpp (945): Recognised Fileformat: pdf
graphics/GraphicsCacheItem.cpp (293): Loading image.
Error: /syntaxerror in (bin obj seq, type=128, elements=1, size=6917, non-zero unused field)
Operand stack:

Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1884   1   3   %oparray_pop   1883   1   3   %oparray_pop   1867   1   3   %oparray_pop   1755   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1172/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--   --dict:67/75(L)--
Current allocation mode is local
Last OS error: No such file or directory
GPL Ghostscript 9.10: Unrecoverable error, exit code 1
 /home/psmith/newfile1.lyx.emergency

lyx: SIGSEGV signal caught!
Sorry, you have found a bug in LyX, hope you have not lost any data.
Please read the bug-reporting instructions in 'Help->Introduction' and send us a bug report, if necessary. Thanks!
Bye.
Error: LyX crashed!
----------------------------------------
SIGSEGV signal caught!
Sorry, you have found a bug in LyX, hope you have not lost any data.
Please read the bug-reporting instructions in 'Help->Introduction' and send us a bug report, if necessary. Thanks!
Bye.
Aborted (core dumped)

Comment 3 José Matos 2014-04-14 20:19:30 UTC
I am sorry for being late here I have been busy with other issues.

LyX 2.1.0 should be released soon (in a couple of days).

I have not seen this problem with lyx 2.1.0 (the latest being rc1).

I intend to issue a build for updates-testing as soon as 2.1.0 is released.

Comment 4 Fedora Update System 2014-04-15 15:53:23 UTC
lyx-2.1.0-0.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/lyx-2.1.0-0.fc20

Comment 5 Fedora Update System 2014-04-15 15:54:57 UTC
lyx-2.1.0-0.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/lyx-2.1.0-0.fc19

Comment 6 Fedora Update System 2014-04-16 09:21:09 UTC
Package lyx-2.1.0-0.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing lyx-2.1.0-0.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-5212/lyx-2.1.0-0.fc20
then log in and leave karma (feedback).

Comment 7 Paul Smith 2014-04-16 16:02:39 UTC
Thanks, José. Unfortunately, I cannot test that, since I am still running F19.

Comment 8 José Matos 2014-04-16 16:19:11 UTC
The update is available for F19 as you can see from comment 5. The update is available for F19, F20 and rawhide.

Comment 9 Paul Smith 2014-04-16 20:57:32 UTC
Thanks again, José. I did try updating LyX this morning, but with no success.

I could now update LyX, and I have unfortunately to tell you that the reported problem persists.

Comment 10 José Matos 2014-04-16 21:33:33 UTC
Right.

When you go to

Tools -> Preferences -> File Handling -> Converters

what is the converter definition for the pdf -> eps path?

In my case I have

From format: PDF(graphics)
To format: EPS

Converter: pdftops -eps -f 1 -l 1 $$i $$o

in this case $$i is the input file name and $$o is the output file name.

Could you apply this converter in the command line and see what is the resulting file?

In the case above it would be

pdftops -eps -f 1 -l 1 testfile.pdf testfile.eps

I suspect that the conversion is failing and the resulting file is empty...

Comment 11 Paul Smith 2014-04-16 22:15:29 UTC
Thanks, José. I guess you are right: Probably, it is a conversion problem.

When I run

pdftops -eps -f 1 -l 1 testfile.pdf testfile.eps

the eps file is created. However, I cannot view the eps on Okular.

I did 

yum reinstall poppler-utils

but with no progress.

Comment 12 José Matos 2014-04-16 23:38:43 UTC
I suspect that it is an empty file (zero size).

What is the output on the command line of

ls -l testfile.eps

FWIW any file browser like dolphin will tell you that.

In any case it is a bug of lyx to crash with a badly formatted input.

Comment 13 Paul Smith 2014-04-17 09:05:29 UTC
Thanks, José.

Your request:

$ ls -l test*
-rw-rw-r--. 1 psmith psmith 2728497 Apr 17 10:00 testfile.eps
-rw-r--r--. 1 psmith psmith    5180 Apr 17 10:00 testfile.pdf
$ 

I am attaching testfile.eps for your inspection.

Comment 14 Paul Smith 2014-04-17 09:14:28 UTC
Created attachment 887120 [details]
The converted eps file

Comment 15 José Matos 2014-04-17 23:26:19 UTC
An additional search revealed that this is a known problem of pdftops:

(a thread from last December with the same problem you refer to)
http://comments.gmane.org/gmane.editors.lyx.general/80886

The bug on lyx side is to crash but as the thread shows there are several workarounds to this problem. In any case this is a problem with Fedora 19 pdftops because the Fedora 20 versions works flawlessly.

Comment 16 Paul Smith 2014-04-18 12:43:26 UTC
Thanks, José. As soon as I upgrade to F20, I will let you know whether the problem persists or not.

Comment 17 Fedora Update System 2014-04-27 09:06:57 UTC
lyx-2.1.0-0.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 18 Fedora Update System 2014-04-27 09:09:08 UTC
lyx-2.1.0-0.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.