Summary: | Cannot save as JPEG after updating to KDE 6 beta | ||
---|---|---|---|
Product: | [Applications] Spectacle | Reporter: | alexmateescu |
Component: | General | Assignee: | Noah Davis <noahadvs> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | CC: | faure, kde, kde, mike, nate, nicolas.fella, putr4.s |
Priority: | NOR | Keywords: | qt6 |
Version First Reported In: | 24.01.80 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
alexmateescu
2023-12-03 00:34:51 UTC
This doesn't seem to be a problem specific to Spectacle, I tried using Kolourpaint (from kdesrc-build) to save to a JPEG file and it too showed the same behaviour with showing JFIF as the file extension, and naturally saving doesn't actually work like that either. The culprit seems to be shared-mime-info 2.4. It works fine with 2.2 https://gitlab.freedesktop.org/xdg/shared-mime-info/-/commit/35eca7eccc1a56a1d195af43ff37c8a7f7fbd67b added .jfif as an additional extension to image/jpeg. When saving the image we use QMimeDataBase/QMimeType to get the extension for image/jpeg: https://invent.kde.org/frameworks/kio/-/blob/master/src/filewidgets/kfilewidget.cpp#L2257 mime.preferredSuffix() gives us jfif, presumably because that comes first in the alphabet and there is no other preference specified in shared-mime-info. I'd expect either *.jpeg or *.jpg to be the preferred one since those are the commonly used ones. David, something to fix in shared-mime-info? mime.globPatterns() gives ("*.jfif") only, I'd expect that to return all globs specified in shared-mime-info. A bug in QMimeDataBase? The fact that QImageReader doesn't know jfif is probably another bug in itself @Nicolas I'm very surprised. tst_QMimeDatabase::suffixes_data() makes sure that db.mimeTypeForName("image/jpeg") returns a QMimeType that says preferredSuffix() == "jpg", when using (only) the shared-mime-info mimetype definitions. Would you happen to have anything else in /usr/share/mime/packages or ~/.local/share/mime/packages? For investigation you can use grep image/jpeg /usr/share/mime/globs2 grep image/jpeg ~/.local/share/mime/globs2 Here I get the expected 4 lines from the first grep, and nothing from the second grep. And /usr/share/mime/image/jpeg.xml has all 4, with *.jpg first (which is what makes it the preferred suffix). Do you (or anyone else here) get different results? *.jfif was added in shared-mime-info 2.4 (latest release), earlier releases are not relevant indeed. But make sure you don't have two versions installed at the same time. The `grep image/jpeg /usr/share/mime/globs2` command returns: 50:image/jpeg:*.jfif 50:image/jpeg:*.jpeg 50:image/jpeg:*.jpe 50:image/jpeg:*.jpg The `grep image/jpeg ~/.local/share/mime/globs2` command returns: 50:image/jpeg:*.jfif I'm also on Arch Linux for what it's worth. Oh, so it seems that the thing adding .jfif in my case to ~/.local/share/mime/globs2 is `~/local/share/mime/packages/x-wine-extension-jfif.xml`, deleting that and running `update-mime-database ~/.local/share/mime` fixes the problem for me. So, I guess something ends up using only the user's database instead of overlaying it on top of the system's database? I too have .local/share/mime/packages/x-wine-extension-jfif.xml on the affected system <?xml version="1.0" encoding="UTF-8"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <mime-type type="image/jpeg"> <glob pattern="*.jfif"/> <comment>JPEG Image</comment> </mime-type> </mime-info> And on the same system Qt5-based Spectacle works as expected but Qt6-based Spectacle gives .jfif This looks like a change in QMimeDataBase between Qt5 and Qt6? Interestingly, adding *.jfif in shared-mime-info was done by a WINE contributor so that Wine wouldn't have to generate such local overwrites anymore. But yeah the old files are still around... I confirm that qt5 and qt6 work differently about this. I'll have to investigate further. Sounds like a bug since there no glob-deleteall in there. fwiw I can reproduce the bug Qt 6.6 but not git dev. Wonder if 4e9944e6c8a456353d243ab268cb0f01ff006faa "QMimeDatabase: collect glob patterns from all locations" fixed it? Kai Uwe: good find, thanks! Indeed, I forgot to add Pick-To: 6.6 to these commits. Backports submitted now in https://codereview.qt-project.org/c/qt/qtbase/+/523541/1 *** Bug 478779 has been marked as a duplicate of this bug. *** |