[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
This bug was fixed in the package qtbase-opensource-src - 5.15.2+dfsg-6 --- qtbase-opensource-src (5.15.2+dfsg-6) unstable; urgency=medium * Backport upstream patch to adjust QMimeDatabase behavior (LP: #1857824). * Make qtbase5-dev break qt5-default (see #976389, LP: #1920130). -- Dmitry Shachnev Sat, 29 May 2021 12:04:21 +0300 ** Changed in: qtbase-opensource-src (Ubuntu) Status: In Progress => Fix Released -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: Fix Released Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
The fix should land in Impish (21.10) very soon: https://launchpad.net/ubuntu/+source/qtbase-opensource-src/5.15.2+dfsg-6. Do you also want a fix for Hirsute (21.04)? If yes, you can help me by filling the SRU template in the description (see https://wiki.ubuntu.com/StableReleaseUpdates#SRU_Bug_Template). -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: In Progress Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
Thank you for the links! ** Changed in: qtbase-opensource-src (Ubuntu) Status: New => In Progress ** Changed in: qtbase-opensource-src (Ubuntu) Assignee: (unassigned) => Dmitry Shachnev (mitya57) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: In Progress Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
Confirmed that patched [1][2] Qt fixes this bug. [1] https://codereview.qt-project.org/c/qt/qtbase/+/328240 [2] https://launchpadlibrarian.net/539330399/qtbase-opensource-src_5.15.2+dfsg-5+0.drop.0_5.15.2+dfsg-5+0.drop.1.diff.gz -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
specially: "The spec hasn't changed, but I made the same mistake in xdgmime (the reference implementation) and in Qt: when multiple globs match, and the result from magic sniffing is unrelated to any of those globs, then I used the magic result, but that's wrong, globs have priority and one of them should be picked up." and there is multiple glob matches: -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
Qt actually prefers system copy from shared-mime-info if it's available. Here is the code for 5.12.8 (used in Ubuntu 20.04): https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/mimetypes/qmimedatabase.cpp?h=5.12.8#n99 The internal copy (":/qt-project.org/qmime") is only used when the system one is missing (fdoIterator == mimeDirs.constEnd()). Furthermore, in Ubuntu 20.10 and 21.04 we are building Qt with -no- mimetype-database, which makes Qt use *only* the system copy: https://salsa.debian.org/qt-kde-team/qt/qtbase/-/commit/f0d53be16a31ea55 So I think it is a bug in shared-mime-info only, not in Qt. Do you agree? -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
maybe fixed: https://codereview.qt-project.org/c/qt/qtbase/+/328240 ** Package changed: kde-cli-tools (Ubuntu) => qtbase-opensource-src (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to qtbase-opensource-src in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in qtbase-opensource-src package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/qtbase-opensource-src/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
Could you please stop that reassigning game? You are right, it's either on shared-mime-info or the qt integration, now the result of the testcase provided is correct on GNOME (see comment 5), it's also correct on a cloud instance (e.g no desktop integration) so it's only buggy on KDE, you should rather reassign to the Qt integration, unsure what the right component for that is though ** Package changed: shared-mime-info (Ubuntu) => kde-cli-tools (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in kde-cli-tools package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
testing with xdgmime [1] (reference implementation of the spec [2] and also used tests on shared-mine-type): > ../xdgmime/src/print-mime-data . test.py: name: text/x-python data: application/xhtml+xml file: application/xhtml+xml > ../xdgmime/src/test-mime test.py File "test.py" has a mime-type of application/xhtml+xml [1] https://gitlab.freedesktop.org/xdg/xdgmime [2] https://freedesktop.org/wiki/Specifications/shared-mime-info-spec/ -- kmimetypefinder5 is just a tiny wrapper over QMimeDatabase [3][4]. So bug is likely on shared-mime-info or Qt implementation. [3] https://github.com/KDE/kde-cli-tools/blob/master/kmimetypefinder/kmimetypefinder.cpp [4] https://bugs.freedesktop.org/show_bug.cgi?id=99672 ** Bug watch added: freedesktop.org Bugzilla #99672 https://bugs.freedesktop.org/show_bug.cgi?id=99672 ** Package changed: kde-cli-tools (Ubuntu) => shared-mime-info (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in kde-cli-tools package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
@Kai, so you use a 'command is provided by a perl utility' as a reason to reasing to shared-mime-info, what's the logic? also xdg-mime works fine under GNOME or when using gio that uses shared-mime-info... ** Package changed: shared-mime-info (Ubuntu) => kde-cli-tools (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in kde-cli-tools package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
> dpkg -S /usr/bin/mimetype libfile-mimeinfo-perl: /usr/bin/mimetype > /usr/bin/mimetype --magic-only foo.py foo.py: application/xhtml+xml ** Package changed: kde-cli-tools (Ubuntu) => shared-mime-info (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in shared-mime-info package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/shared-mime-info/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
it's not a shared-mime-info issue, on a GNOME session the result is right $ xdg-mime query filetype index.py text/x-python ** Package changed: shared-mime-info (Ubuntu) => kde-cli-tools (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in kde-cli-tools package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/kde-cli-tools/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp
[Touch-packages] [Bug 1857824] Re: kmimetypefinder5 misidentifies mimetype of python files containing certain strings
** Package changed: kde-cli-tools (Ubuntu) => shared-mime-info (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to shared-mime-info in Ubuntu. https://bugs.launchpad.net/bugs/1857824 Title: kmimetypefinder5 misidentifies mimetype of python files containing certain strings Status in shared-mime-info package in Ubuntu: New Bug description: Expected behavior: $ kmimetypefinder5 example.py text/x-python3 or $ kmimetypefinder5 example.py text/x-python or $ kmimetypefinder5 example.py text/plain Actual behavior: $ kmimetypefinder5 example.py application/xhtml+xml Summary: Python scripts with a string containing HTML can be misidentified as HTML files by kmimetypefinder5. For example, this python script is identified as "application/xhtml+xml": #! /usr/bin/env python3 example_string = \ """\ http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> http://www.w3.org/1999/xhtml";> Example title Example body """ print('Hello, world!') This difficulty is not shared by other mimetype identification tools. $ kmimetypefinder5 example.py application/xhtml+xml $ cat example2.py #! /usr/bin/env python3 print('Hello, world!') $ kmimetypefinder5 example2.py text/x-python3 $ mimetype 'example.py' example.py: text/x-python $ mimetype 'example2.py' example2.py: text/x-python $ file --mime-type 'example.py' example.py: text/plain $ file --mime-type 'example2.py' example2.py: text/plain $ lsb_release -rd Description: Ubuntu 18.04.3 LTS Release: 18.04 $ apt-cache policy kde-cli-tools kde-cli-tools: Installed: 4:5.12.8-0ubuntu0.1 Candidate: 4:5.12.8-0ubuntu0.1 Version table: *** 4:5.12.8-0ubuntu0.1 500 500 http://us.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages 100 /var/lib/dpkg/status 4:5.12.4-0ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: kde-cli-tools 4:5.12.8-0ubuntu0.1 ProcVersionSignature: Ubuntu 4.15.0-72.81-generic 4.15.18 Uname: Linux 4.15.0-72-generic x86_64 ApportVersion: 2.20.9-0ubuntu7.9 Architecture: amd64 CurrentDesktop: KDE Date: Sun Dec 29 13:28:37 2019 InstallationDate: Installed on 2018-12-12 (381 days ago) InstallationMedia: Kubuntu 18.04.1 LTS "Bionic Beaver" - Release amd64 (20180725) SourcePackage: kde-cli-tools UpgradeStatus: No upgrade log present (probably fresh install) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/shared-mime-info/+bug/1857824/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp