Menu

#49 JlCompress: Critical bug using Qt 5.2.1

v1.0_(example)
open
nobody
None
5
2014-05-08
2014-05-06
No

I am using Quazip for my project and it works great, but now that I am moving my source code from Qt4 to Qt5, my program terminates abnormally, getting this message from console:

QIODevice::open: File access not specified
*** Error in `/usr/local/tupi/bin/tupi.bin': free(): invalid pointer: 0x00007ffff4270d20 ***

I was debugging my code and I found this:

10 0x00007ffff3e6fdd5 in QObject::~QObject() () from /home/xtingray/Qt5.2.1/5.2.1/gcc_64/lib/libQt5Core.so.5
11 0x00007ffff3d7fe82 in QFile::remove(QString const&) () from /home/xtingray/Qt5.2.1/5.2.1/gcc_64/lib/libQt5Core.so.5
12 0x00007ffff014fc98 in JlCompress::compressDir(QString, QString, bool) () from /usr/lib/x86_64-linux-gnu/libquazip.so.0
13 0x00007ffff2ea1034 in TupPackageHandler::makePackage(QString const&, QString const&) () from /usr/local/tupi/lib64/tupi/libtupi.so.1

It seems there's an issue within the method JlCompress::compressDir(QString, QString, bool) and Qt 5.2.x

Thanks!

Discussion

  • Sergey A. Tachenov

    Hmm... I've just tested on fresh Ubuntu 14.04 install using the bundled Qt 5.2.1. Worked fine. My version is 32 bit, though (got no VT-x, can't run 64-bit VM). Could it be that you already had some sort of memory corruption by that point, and that this crash was a side effect of that?

    Try running under Valgrind, preferably with debugging symbols included. That usually does wonders.

     
  • Gustav Gonzalez

    Gustav Gonzalez - 2014-05-07

    This is my story:

    • Right now I'm using Ubuntu 14.04 (64 bits)
    • I started installing the Qt5 packages from the Ubuntu official repository but I found this critical bug: QMenu objects disappear from applications. You can reproduce that bug compiling these examples:
    • http://qt-project.org/doc/qt-5/qtwidgets-mainwindows-menus-example.html
    • http://qt-project.org/doc/qt-5/qtwidgets-mainwindows-application-example.html
    • To avoid that bug, I decided to download the bundled Qt 5.2.1 directly from qt-project.org and compile some Qt examples, including my code. The QMenu objects got back! :)
    • When I was testing the Save/Open features of my project using the Quazip packages from the Ubuntu official repository (libquazip0 & libquazip0-dev), I got two critical errors (this report is one of those). Using gdb I detected that the problem came from two different points of the Quazip code.
    • Then I decided to compile and use the source code of Quazip from your latest release but using the bundled Qt 5.2.1. No bugs, everything worked pretty fine!

    So, summarizing:

    • Ubuntu native Qt5 + Ubuntu native Quazip = No Quazip bugs, but no QMenu objects
    • Bundled Qt5 + Ubuntu native Quazip = 2 Quazip bugs, QMenu objects show up!
    • Bundled Qt5 + compiled Quazip = No Quazip bugs, QMenu objects show up! (the perfect match)

    Last 2 days I have been going crazy testing and trying options. Now that I found the right way, I'm a little sad about the complexity of the settings to compile my project from Ubuntu 14.04 :/

    The million dollar question is: Why the Quazip packages from Ubuntu give me 2 bugs but the compiled binaries don't if we are talking of the same version (0.6.2) ?

     
  • Sergey A. Tachenov

    A real million dollar question. I just apt-get source libquazip0, and it found out that their .orig package is bitwise identical to the one published on my SF.net project page, and that the debian package contains only two minor patches: one removes the ABI version 1.0.0 (which kind of makes sense since the QuaZIP version is 0.6.2) and disables the qztest build (which is obviously not necessary to build a package).

    I can only suggest again that you use Valgrind instead of gdb. It can catch an earlier memory error while gdb only caches the later random crash.

     
  • Sergey A. Tachenov

    I've just tried to run my test suite on the Ubuntu quazip 0.6.2. It crashes on the very first test when trying to create a test archive. This is ridiculous. Something is terribly wrong with the Ubuntu package, but I'm not feeling like doing maintainer's job. I can only advise to build it from sources if in doubt. Even better use the SVN version, the trunk is usually very stable.

     
  • Gustav Gonzalez

    Gustav Gonzalez - 2014-05-07

    Thank you for the feedback! I understand your point about the "maintainer's job" because I suffer from the same problem with my package. Anyway, I would like to learn how to run your test suite, I'm very interested in to report this issue to the Ubuntu community. Could you give me some hint?

     
  • Sergey A. Tachenov

    Something along these lines:

    :::bash
    alqualos@ubuntu:~$ tar xzf quazip-0.6.2.tar.gz 
    alqualos@ubuntu:~$ cd quazip-0.6.2/
    # Rename the source so qztest uses the distribution QuaZIP:
    alqualos@ubuntu:~/quazip-0.6.2$ mv quazip quazip-renamed
    alqualos@ubuntu:~/quazip-0.6.2$ cd qztest/
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ /usr/lib/i386-linux-gnu/qt5/bin/qmake 
    Project WARNING: CONFIG+=qtestlib is deprecated. Use QT+=testlib instead.
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ make
    # lots of make stuff goes here and ends with this:
    .obj/testquazipfile.o: In function `TestQuaZipFile::setFileAttrs()':
    testquazipfile.cpp:(.text+0x50ba): undefined reference to `QuaZipNewInfo::setPermissions(QFlags<QFileDevice::Permission>)'
    collect2: error: ld returned 1 exit status
    make: *** [qztest] Error 1
    # The error above is because of a really silly bug in 0.6.2:
    # it declares a function, but never defines it.
    # In order to get around it, we must edit testquazipfile.cpp
    # and comment out the whole body of the last function,
    # that is, TestQuaZipFile::setFileAttrs():
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ vim testquazipfile.cpp 
    # editing goes here
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ make
    # Now it compiles OK.
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ ./qztest 
    ********* Start testing of TestQuaZip *********
    Config: Using QtTest library 5.2.1, Qt 5.2.1
    PASS   : TestQuaZip::initTestCase()
    QFATAL : TestQuaZip::getFileList(simple) Received signal 11
    FAIL!  : TestQuaZip::getFileList(simple) Received a fatal error.
       Loc: [Unknown file(0)]
    Totals: 1 passed, 1 failed, 0 skipped
    ********* Finished testing of TestQuaZip *********
    Aborted (core dumped)
    # Now let's try with the sources:
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ cd ..
    alqualos@ubuntu:~/quazip-0.6.2$ mv quazip-renamed quazip
    alqualos@ubuntu:~/quazip-0.6.2$ cd quazip/
    alqualos@ubuntu:~/quazip-0.6.2/quazip$ /usr/lib/i386-linux-gnu/qt5/bin/qmake 
    alqualos@ubuntu:~/quazip-0.6.2/quazip$ make
    # lots of make stuff
    alqualos@ubuntu:~/quazip-0.6.2/quazip$ cd ../qztest/
    # Now we should re-link qztest because the library name is different:
    # Ubuntu provides libquazip.so.0, while QuaZIP builds by default as libquazip.so.1
    # Even better would be to recompile completely, but I've compared the headers,
    # and they are exactly identical in Ubuntu and in quazip-0.6.2.tar.gz,
    # so re-linking should do the job:
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ rm qztest
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ make
    # link stuff goes here
    alqualos@ubuntu:~/quazip-0.6.2/qztest$ env LD_LIBRARY_PATH=../quazip ./qztest
    # Now every test passes OK.
    
     
MongoDB Logo MongoDB