Bug 164501

Summary: Okular crashes while opening DVI-Files
Product: [Applications] okular Reporter: bve
Component: DVI backendAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: crash CC: thomas.braun
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian testing   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: example minimal.dvi causing okular to crash
Map file from texlive
Possible fix.

Description bve 2008-06-20 11:11:09 UTC
Version:           0.6.80 (using KDE 4.0.80)
Installed from:    Debian testing/unstable Packages
OS:                Linux

Okular crashes when I try to open dvi-files. 

The output on the command-line is:

okular
okular(8173) KMimeTypeFactory::parseMagic: Now parsing  "/usr/share/mime/magic"
QObject::connect: Cannot connect (null)::rowsRemoved(const QModelIndex&, int, int) to KFilePlacesView::adaptItemSize()
ASSERT: "i >= 0 && i < size()" in file /usr/include/qt4/QtCore/qstring.h, line 650

I tried with several dvis, for example the attached minimal.dvi (latex-output).
Comment 1 bve 2008-06-20 11:12:24 UTC
Created attachment 25469 [details]
example minimal.dvi causing okular to crash
Comment 2 Pino Toscano 2008-06-20 11:30:21 UTC
Works here; could you please paste the backtrace?
Comment 3 bve 2008-06-20 11:43:45 UTC
How do I produce a backtrace? The kde-crash-window which normally shows me the backtrace doesn't appear.
Comment 4 Pino Toscano 2008-06-20 11:46:55 UTC
in a console:
$ gdb --args okular thefile.dvi
...
(gdb) run
then wait for the crash:
(gdb) thread apply all bt
to get the backtrace; then
(gdb) quit
to close
Comment 5 bve 2008-06-20 12:07:12 UTC
ok, I did that: 

bve@bensnotebook:~/test$ gdb --args okular minimal.dvi
GNU gdb 6.7.1-debian
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(no debugging symbols found)
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/okular minimal.dvi
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
---Type <return> to continue, or q <return> to quit---
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
---Type <return> to continue, or q <return> to quit---
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0xb61fb940 (LWP 10875)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
---Type <return> to continue, or q <return> to quit---
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[New Thread 0xb2ba6b90 (LWP 10893)]
ASSERT: "i >= 0 && i < size()" in file /usr/include/qt4/QtCore/qstring.h, line 650
[Thread 0xb2ba6b90 (LWP 10893) exited]

Program exited with code 01.
(gdb) thread apply all bt
No registers.
(gdb) quit
Comment 6 Pino Toscano 2008-06-20 12:09:35 UTC
> (no debugging symbols found)

Unuseful; please install the debug package(s) from your distro, first.
Comment 7 bve 2008-06-20 14:49:53 UTC
Didn't find any okular-dbg for debian. I keep on searching what debug package(s) I might need.
Comment 8 Luigi Toscano 2008-06-20 15:03:44 UTC
> Didn't find any okular-dbg for debian. 

The package you are looking for is kdegraphics-dbg.
Comment 9 bve 2008-07-08 18:06:49 UTC
Thanks. I realized, that it didn't happen on a non kde3/kde4-mixed system (my other pc), so this might not be a problem of okular. Anyways, I install kdegraphics-dbg (for kde4), but it didn't seem to give me more information than before:

gdb --args okular EUzuWTO.dvi
GNU gdb 6.7.1-debian
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
(gdb) run
Starting program: /usr/bin/okular EUzuWTO.dvi
[Thread debugging using libthread_db enabled]
[New Thread 0xb61d7720 (LWP 29363)]
[New Thread 0xb2875b90 (LWP 29383)]
ASSERT: "i >= 0 && i < size()" in file /usr/include/qt4/QtCore/qstring.h, line 650
[Thread 0xb2875b90 (LWP 29383) exited]

Program exited with code 01.
(gdb) thread apply all bt
No registers.
(gdb)                

Greetings,

Ben
Comment 10 Pino Toscano 2008-08-05 19:45:11 UTC
Hi,

do you still have this crash with a more recent Okular version?
Comment 11 bve 2008-08-06 10:17:11 UTC
Yes, with okular 0.7 from debian experimental (kde 4.1.00). The error message on the command line is the same as above.

Again, I tried with gdb, but nothing special:

gdb --args okular florian_rede.dvi
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
(gdb) run
Starting program: /usr/bin/okular florian_rede.dvi
[Thread debugging using libthread_db enabled]
[New Thread 0xb61ac720 (LWP 6185)]
[New Thread 0xb2b82b90 (LWP 6265)]
ASSERT: "i >= 0 && i < size()" in file /usr/include/qt4/QtCore/qstring.h, line 650
[Thread 0xb2b82b90 (LWP 6265) exited]

Program exited with code 01.
(gdb) thread apply all bt
No registers.
(gdb)                   
Comment 12 Thomas Braun 2009-01-12 13:13:08 UTC
Hi,

I also can reproduce this bug here.
My system debian lenny with KDE trunk svn from 9.01.2009 self-compiled.
And this is also a KDE3/KDE4 mix system.
QT-Version: 4.4.3-1 from debian


Backtrace (which is hopefully useful):
Application: Okular (okular), signal SIGABRT
[Current thread is 0 (LWP 10117)]

Thread 2 (Thread 0xb29afb90 (LWP 10119)):
#0  0xb7f67424 in __kernel_vsyscall ()
#1  0xb68419f1 in select () from /lib/i686/cmov/libc.so.6
#2  0xb7423660 in ?? () from /usr/lib/libQtCore.so.4
#3  0xb735452e in ?? () from /usr/lib/libQtCore.so.4
#4  0xb72eb4c0 in start_thread () from /lib/i686/cmov/libpthread.so.0
#5  0xb684961e in clone () from /lib/i686/cmov/libc.so.6

Thread 1 (Thread 0xb61096c0 (LWP 10117)):
[KCrash Handler]
#6  0xb7f67424 in __kernel_vsyscall ()
#7  0xb6794640 in raise () from /lib/i686/cmov/libc.so.6
#8  0xb6796018 in abort () from /lib/i686/cmov/libc.so.6
#9  0xb734c6cd in qt_message_output () from /usr/lib/libQtCore.so.4
#10 0xb734c796 in qFatal () from /usr/lib/libQtCore.so.4
#11 0xb734c825 in qt_assert () from /usr/lib/libQtCore.so.4
#12 0xb2d299ac in fontMap (this=0x9d3dad0) at /usr/include/qt4/QtCore/qstring.h:644
#13 0xb2d2e02b in fontPool (this=0x9d3daa0) at /home/kdedev/kde/src/KDE/kdegraphics/okular/generators/dvi/fontpool.cpp:45
#14 0xb2cfb8ec in dviRenderer (this=0x9d3da80) at /home/kdedev/kde/src/KDE/kdegraphics/okular/generators/dvi/dviRenderer.cpp:69
#15 0xb2cf992f in DviGenerator::loadDocument (this=0x9d4fea0, fileName=@0xbfe80428, pagesVector=@0x9af7ac4) at /home/kdedev/kde/src/KDE/kdegraphics/okular/generators/dvi/generator_dvi.cpp:69
#16 0xb471c491 in Okular::DocumentPrivate::openDocumentInternal (this=0x9af7a10, offer=@0xbfe801e0, isstdin=false, docFile=@0xbfe80428, filedata=@0xbfe80260)
    at /home/kdedev/kde/src/KDE/kdegraphics/okular/core/document.cpp:643
#17 0xb4729ba3 in Okular::Document::openDocument (this=0x9acd130, docFile=@0xbfe80428, url=@0xbfe8039c, _mime=@0xbfe80448) at /home/kdedev/kde/src/KDE/kdegraphics/okular/core/document.cpp:1593
#18 0xb47aeba6 in Part::openFile (this=0x9aae310) at /home/kdedev/kde/src/KDE/kdegraphics/okular/part.cpp:874
#19 0xb7f423b1 in KParts::ReadOnlyPart::openUrl (this=0x9aae310, url=@0xbfe805b4) at /home/kdedev/kde/src/KDE/kdelibs/kparts/part.cpp:558
#20 0xb47a9a0c in Part::openUrl (this=0x9aae310, url=@0xbfe805b4) at /home/kdedev/kde/src/KDE/kdegraphics/okular/part.cpp:970
#21 0x08050062 in Shell::openUrl (this=0x9a47ee8, url=@0xbfe805b4, page=0) at /home/kdedev/kde/src/KDE/kdegraphics/okular/shell/shell.cpp:136
#22 0x08050e57 in Shell::fileOpen (this=0x9a47ee8) at /home/kdedev/kde/src/KDE/kdegraphics/okular/shell/shell.cpp:256
#23 0x0805102b in Shell::qt_metacall (this=0x9a47ee8, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0xbfe8071c) at /home/kdedev/kde/build/KDE/kdegraphics/okular/shell/shell.moc:85
#24 0xb7458bd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#25 0xb7458fd0 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#26 0xb6b1a4a1 in QAction::triggered () from /usr/lib/libQtGui.so.4
#27 0xb6b1ae0f in QAction::activate () from /usr/lib/libQtGui.so.4
#28 0xb6ef41f4 in ?? () from /usr/lib/libQtGui.so.4
#29 0xb6ef4c82 in QMenu::mouseReleaseEvent () from /usr/lib/libQtGui.so.4
#30 0xb7a9e10e in KMenu::mouseReleaseEvent (this=0x9bd23a8, e=0xbfe80f2c) at /home/kdedev/kde/src/KDE/kdelibs/kdeui/widgets/kmenu.cpp:454
#31 0xb6b787c2 in QWidget::event () from /usr/lib/libQtGui.so.4
#32 0xb6ef6f79 in QMenu::event () from /usr/lib/libQtGui.so.4
#33 0xb6b2079c in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#34 0xb6b28fd1 in QApplication::notify () from /usr/lib/libQtGui.so.4
#35 0xb79bd033 in KApplication::notify (this=0xbfe8174c, receiver=0x9bd23a8, event=0xbfe80f2c) at /home/kdedev/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:307
#36 0xb74440d1 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#37 0xb6b2825e in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#38 0xb6b92047 in ?? () from /usr/lib/libQtGui.so.4
#39 0xb6b90be1 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#40 0xb6bba60a in ?? () from /usr/lib/libQtGui.so.4
#41 0xb64261b8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#42 0xb6429853 in ?? () from /usr/lib/libglib-2.0.so.0
#43 0x099d1a98 in ?? ()
#44 0x00000000 in ?? ()

Comment 13 Pino Toscano 2009-01-12 13:49:34 UTC
@Thomas Braun:
do you have texlive-base-bin installed?
If so, what do `kpsewhich --format=map ps2pk.map` and `kpsewhich --format=dvips config ps2pk.map` return?
Comment 14 Thomas Braun 2009-01-12 14:17:19 UTC
@Pino Toscano:
Yes, in version 2007.dfsg.2-4.
And the calls return:
kdedev@thomas:~$ kpsewhich --format=map ps2pk.map
/var/lib/texmf/fonts/map/dvips/updmap/ps2pk.map
kdedev@thomas:~$ kpsewhich --format=dvips config ps2pk.map
/var/lib/texmf/fonts/map/dvips/updmap/ps2pk.map
kdedev@thomas:~$ kpsewhich --format=dvipsconfig ps2pk.map
/var/lib/texmf/fonts/map/dvips/updmap/ps2pk.map
kdedev@thomas:~$ kpsewhich  ps2pk.map
/var/lib/texmf/fonts/map/dvips/updmap/ps2pk.map
Comment 15 Pino Toscano 2009-01-12 14:59:38 UTC
> kdedev@thomas:~$ kpsewhich --format=map ps2pk.map
> /var/lib/texmf/fonts/map/dvips/updmap/ps2pk.map

Does this file contain empty lines (even the last one)?
Comment 16 Thomas Braun 2009-01-12 15:30:42 UTC
Created attachment 30192 [details]
Map file from texlive
Comment 17 Thomas Braun 2009-01-12 15:31:48 UTC
Yes,
the sixth line (first non comment) is empty.
The file is also attached.
Comment 18 Pino Toscano 2009-01-12 15:41:33 UTC
Created attachment 30195 [details]
Possible fix.

This should make the reader of such map files sip empty lines.

@Thomas: could you please try it?
Comment 19 Thomas Braun 2009-01-12 17:09:59 UTC
Tried the patch and it does not crash anymore :)

Thanks a lot!

Thomas
Comment 20 Pino Toscano 2009-01-12 17:15:51 UTC
SVN commit 910060 by pino:

Ignore empty lines when parsing TeX font maps.
BUG: 164501


 M  +1 -1      fontMap.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=910060
Comment 21 Pino Toscano 2009-01-12 17:16:35 UTC
SVN commit 910061 by pino:

Backport: ignore empty lines when parsing TeX font maps.
CCBUG: 164501


 M  +1 -1      fontMap.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=910061
Comment 22 Pino Toscano 2009-01-12 17:19:38 UTC
This will be in KDE 4.2 final.

Thanks a lot for the help, Thomas!
(And I wonder why your ps2pk.map has an empty line while mine doesn't, given that I'm running Debian Lenny and its *tex stuff...)
Comment 23 Thomas Braun 2009-01-12 17:32:06 UTC
Your welcome!

And besides a DVI viewer is very important for kile ;)

I have no idea why my file has an empty line ...