| Summary: | Kate has closed when trying to save a .gz file | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Guillaume Debray <yoggic> |
| Component: | kwrite | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | crash | CC: | artghio, christoph, egorov, eu, faure, rlaggren |
| Priority: | NOR | Keywords: | drkonqi |
| Version First Reported In: | 3.13.1 | ||
| Target Milestone: | --- | ||
| Platform: | Ubuntu | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
|
Description
Guillaume Debray
2014-05-21 08:38:49 UTC
Hm, we're just calling flush on the stream. David, could you have a look at the backtrace? This is KDE 4.13.1. Can reproduce: Application: KWrite (kwrite), signal: Segmentation fault Using host libthread_db library "/lib64/libthread_db.so.1". [KCrash Handler] #5 0x00007f05e46ad922 in deflate () from /lib64/libz.so.1 #6 0x00007f05e74adfbc in KGzipFilter::compress (this=0x11942d0, finish=<optimized out>) at /usr/src/debug/kdelibs-4.13.1/kdecore/compression/kgzipfilter.cpp:363 #7 0x00007f05e74b015c in KFilterDev::writeData (this=0xe25640, data=0x11be0b8 "2000-08-12 Norman Walsh <ndw@nwalsh.com>\n\n\t* 40chg.txt: Updated; changed version number\n\n\t* 41chg.txt, readme.txt: Updated; changed version number, release date\n\n\t* calstblx.dtd, dbcentx.mod, dbgene"..., len=3434) at /usr/src/debug/kdelibs-4.13.1/kdecore/compression/kfilterdev.cpp:302 #8 0x00007f05e7037830 in QIODevice::write(char const*, long long) () from /usr/lib64/libQtCore.so.4 #9 0x00007f05e7044c2d in ?? () from /usr/lib64/libQtCore.so.4 #10 0x00007f05d683eba0 in Kate::TextBuffer::save (this=0xccb700, filename=...) at /home/dh/kde/kate/part/buffer/katetextbuffer.cpp:799 #11 0x00007f05d68aa962 in KateBuffer::saveFile (this=0xccb700, m_file=...) at /home/dh/kde/kate/part/document/katebuffer.cpp:273 #12 0x00007f05d68a24c3 in KateDocument::saveFile (this=0xccac80) at /home/dh/kde/kate/part/document/katedocument.cpp:2207 #13 0x00007f05e9aceb7c in KParts::ReadWritePart::save() () from /usr/lib64/libkparts.so.4 #14 0x00007f05d688c813 in KateDocument::documentSave (this=0xccac80) at /home/dh/kde/kate/part/document/katedocument.cpp:3905 #15 0x00007f05d68a36c7 in KateDocument::qt_static_metacall (_o=0xccac80, _c=<optimized out>, _id=54, _a=0x7fff1df107c0) at /home/dh/kde/kate/build/part/katedocument.moc:279 Using valgrind, I get: KGzipFilter: Unsupported mode 10 . Only QIODevice::ReadOnly and QIODevice::WriteOnly supported ==15084== Conditional jump or move depends on uninitialised value(s) ==15084== at 0xA6D78FB: deflate (in /lib64/libz.so.1.2.8) ==15084== by 0x7759FBB: KGzipFilter::compress(bool) (kgzipfilter.cpp:363) ==15084== by 0x775C15B: KFilterDev::writeData(char const*, long long) (kfilterdev.cpp:302) ==15084== by 0x7C9582F: QIODevice::write(char const*, long long) (in /usr/lib64/libQtCore.so.4.8.5) ==15084== by 0x7CA2C2C: ??? (in /usr/lib64/libQtCore.so.4.8.5) ==15084== by 0x1A7A2B9F: Kate::TextBuffer::save(QString const&) (katetextbuffer.cpp:799) ==15084== by 0x1A80E961: KateBuffer::saveFile(QString const&) (katebuffer.cpp:273) ==15084== by 0x1A8064C2: KateDocument::saveFile() (katedocument.cpp:2207) ==15084== by 0x52BFB7B: KParts::ReadWritePart::save() (in /usr/lib64/libkparts.so.4.13.1) ==15084== by 0x1A7F0812: KateDocument::documentSave() (katedocument.cpp:3905) ==15084== by 0x1A8076C6: KateDocument::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (katedocument.moc:279) ==15084== by 0x7D18D67: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.5) ==15084== deflate returned -2 Again the trace with self-build libz version 1.2.8:
KGzipFilter: Unsupported mode 10 . Only QIODevice::ReadOnly and QIODevice::WriteOnly supported
==16843== Conditional jump or move depends on uninitialised value(s)
==16843== at 0xA6D7F36: deflate (deflate.c:672)
==16843== by 0x7759FBB: KGzipFilter::compress(bool) (kgzipfilter.cpp:363)
==16843== by 0x775C15B: KFilterDev::writeData(char const*, long long) (kfilterdev.cpp:302)
==16843== by 0x7C9582F: QIODevice::write(char const*, long long) (in /usr/lib64/libQtCore.so.4.8.5)
==16843== by 0x7CA2C2C: ??? (in /usr/lib64/libQtCore.so.4.8.5)
==16843== by 0x1A7A9B9F: Kate::TextBuffer::save(QString const&) (katetextbuffer.cpp:799)
==16843== by 0x1A815961: KateBuffer::saveFile(QString const&) (katebuffer.cpp:273)
==16843== by 0x1A80D4C2: KateDocument::saveFile() (katedocument.cpp:2207)
==16843== by 0x52BFB7B: KParts::ReadWritePart::save() (in /usr/lib64/libkparts.so.4.13.1)
==16843== by 0x1A7F7812: KateDocument::documentSave() (katedocument.cpp:3905)
==16843== by 0x1A80E6C6: KateDocument::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (katedocument.moc:279)
==16843== by 0x7D18D67: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (in /usr/lib64/libQtCore.so.4.8.5)
==16843==
deflate returned -2
defalte.c looks like this:
664 /* ========================================================================= */
665 int ZEXPORT deflate (strm, flush)
666 z_streamp strm;
667 int flush;
668 {
669 int old_flush; /* value of flush param for previous deflate call */
700 deflate_state *s;
701
702 if (strm == Z_NULL || strm->state == Z_NULL ||
703 flush > Z_BLOCK || flush < 0) {
704 return Z_STREAM_ERROR;
705 }
706 s = strm->state;
See: http://code.woboq.org/gcc/zlib/deflate.c.html#670
Not reproducible in KDE Frameworks 5. *** Bug 334717 has been marked as a duplicate of this bug. *** *** Bug 336922 has been marked as a duplicate of this bug. *** The key problem is this: KGzipFilter: Unsupported mode 10 . Only QIODevice::ReadOnly and QIODevice::WriteOnly supported Kate pass QIODevice::WriteOnly | QIODevice::Truncate flags to KGzipFilter, which can accept only QIODevice::WriteOnly. KGzipFilter don't run deflateInit2() and following call to deflate() fails. Problem is solved about a year ago with this commit: commit 84ed5e973ad22936c2b5813b9421f859002d33e3 Author: Christoph Cullmann <cullmann@kde.org> Date: Tue Dec 31 14:53:05 2013 +0100 filter device doesn't like truncate diff --git a/part/buffer/katetextbuffer.cpp b/part/buffer/katetextbuffer.cpp index c63c1cb..05acfeb 100644 --- a/part/buffer/katetextbuffer.cpp +++ b/part/buffer/katetextbuffer.cpp @@ -735,7 +735,7 @@ bool TextBuffer::save (const QString &filename) /** * try to open, if new file */ - if (!file.open (QIODevice::WriteOnly | QIODevice::Truncate)) + if (!file.open (QIODevice::WriteOnly)) return false; /** Then all is fine, if the above patch is in KF5. |