Bug 429511 - QMimeDatabase: Error loading internal MIME data
Summary: QMimeDatabase: Error loading internal MIME data
Status: RESOLVED FIXED
Alias: None
Product: Craft
Classification: Unmaintained
Component: Core (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Hannah von Reth
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-22 16:36 UTC by george fb
Modified: 2022-07-16 12:33 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description george fb 2020-11-22 16:36:07 UTC
SUMMARY

Qt installed by craft fails to find/load the mime database, if I use qt installed through the online installer it works.


STEPS TO REPRODUCE
1. Set up craft and install qtbase
2. In Qt Creator create new qt widgets application
3. add QMimeDatabase db; qDebug() << db.allMimeTypes(); to main function
4. run

OBSERVED RESULT
QMimeDatabase: Error loading internal MIME data
An error has been encountered at line 1 of <internal MIME data>: Premature end of document.:
()

EXPECTED RESULT
Mime types database is loaded and all types are printed

SOFTWARE/OS VERSIONS
Windows: 10 Pro
Version: 20H2
OS build: 19042.630
Experience: Windows Feature Experience Pack 120.2212.31.0

Qt Version: 5.15.1

ADDITIONAL INFORMATION
I have a freedesktop.org.xml and kde5.xml in C:\CraftRoot\bin\data\mime\packages.
QT Creator is installed through chocolatey since craft fails to install it.

------- QT Kit -------
C++ compiler: C:\CraftRoot\mingw64\bin\g++.exe
C compiler: C:\CraftRoot\mingw64\bin\gcc.exe
gdb: C:\CraftRoot\mingw64\bin\gdb.exe
CMake: C:\CraftRoot\dev-utils\cmake-base\bin\cmake.exe
qmake:C:\CraftRoot\bin\qmake.exe

Environment
PATH=$(PATH);C:\CraftRoot\bin;C:\CraftRoot\dev-utils\bin\;C:\CraftRoot\mingw64\bin
QT_ASSUME_STDERR_HAS_CONSOLE=1

CMake config
CMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
CMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
CMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX};C:\CraftRoot
QT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
Comment 1 Jean-Baptiste Mardelle 2020-12-12 20:53:30 UTC
I can confirm this bug is also affecting us in Kdenlive and breaks several core parts of the application. This issue appeared in Qt 5.15.1's Craft version build on the 5th of november. Previous builds of Qt 5.15.1 in Craft did not have this issue.
Comment 2 Vincent PINON 2020-12-13 20:34:24 UTC
Hello,

On my side my test app does find the mime database only if the exe is in CraftRoot/bin, in which there is a data/mime folder holding interesting data.

From the error message, this appens if qt has been built with "mimetype_database" option, which maybe is not enabled in qt installer version (https://codereview.qt-project.org/c/qt/qtbase/+/263548/26/src/corelib/mimetypes/qmimeprovider.cpp)
Comment 3 Jasem Mutlaq 2021-03-06 16:48:45 UTC
I can confirm this bug as well, it's affecting KStars KNewStuff download in Windows 10. This is causing a lot of grief for our end users. I filed a bug report here: https://bugs.kde.org/show_bug.cgi?id=434033
Comment 4 Jasem Mutlaq 2021-03-06 19:21:33 UTC
Vincent THANK YOU!

I copied the mime folder from CraftRoot/bin/data to KStars and it worked!
Comment 5 Jasem Mutlaq 2021-03-06 19:27:14 UTC
I find out that KStars recipe was blacklisting mime directory. I removed that and now will test again.
Comment 6 Bug Janitor Service 2021-11-04 14:22:00 UTC
A possibly relevant merge request was started @ https://invent.kde.org/packaging/craft-blueprints-kde/-/merge_requests/253
Comment 7 Hannah von Reth 2021-11-04 17:31:42 UTC
Git commit 21bcc9ddec7a0f306f3de4876fd5c2513982dc0c by Hannah von Reth.
Committed on 04/11/2021 at 17:31.
Pushed by vonreth into branch 'master'.

Fix build in mimedb

A bug in the generation script dropped all \r from the compressed
resource, corrupting the blob.

A  +11   -0    libs/qt5/qtbase/.qt-5.15.2/fixe_compressed_mime_data_win.diff
M  +1    -1    libs/qt5/qtbase/qtbase.py

https://invent.kde.org/packaging/craft-blueprints-kde/commit/21bcc9ddec7a0f306f3de4876fd5c2513982dc0c