Bug 440631 - Mimetype - MPEG-2 TS .ts video file flagged as text/vnd.qt.linguist
Summary: Mimetype - MPEG-2 TS .ts video file flagged as text/vnd.qt.linguist
Status: RESOLVED UPSTREAM
Alias: None
Product: frameworks-kfilemetadata
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.84.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Pinak Ahuja
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-05 14:53 UTC by tagwerk19
Modified: 2023-07-05 17:53 UTC (History)
2 users (show)

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


Attachments
Synthetic test for video/mp2t (4.34 KB, text/vnd.trolltech.linguist)
2021-08-10 21:19 UTC, tagwerk19
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-08-05 14:53:08 UTC
SUMMARY:

    A MPEG-2 TS file, saved with a .ts extension is flagged
    as text/vnd.qt.linguist

STEPS TO REPRODUCE:

    Download a .m2ts file, check with

        xdg-mime query filetype testfile.m2ts 

    it would be shown as "video/mp2t". Rename to .ts and repeat... 

OBSERVED RESULTS

    $ xdg-mime query filetype x.ts
    text/vnd.qt.linguist 

EXPECTED RESULTS

    $ xdg-mime query filetype x.ts
    video/mp2t

SOFTWARE/OS VERSIONS

    Neon Testing

    Plasma : 5.22.4
    Frameworks : 5.85.0
    Qt : 5.15.5 

ADDITIONAL INFORMATION

    Seems to be an issue with the "magic" for the MPEG-2 TS entry, it has
    priority "50". The Linguist entry also has an implicit priority of 50
    (the default priority)

    If the MPEG-2 TS priority is increased to 70 in an "override.xml" file
    (in /usr/share/mime/packages folder), this fixes this issue

    (Issue extracted from Bug 420939)
Comment 1 tagwerk19 2021-08-05 16:47:50 UTC
Also upstream:
    https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/166

Impacts baloo as it depends on the mimetype to work out whether it extracts video specific metadata
Comment 2 tagwerk19 2021-08-10 21:19:07 UTC
Created attachment 140645 [details]
Synthetic test for video/mp2t
Comment 3 tagwerk19 2021-08-10 21:51:24 UTC
Looks like a regression with KDE Frameworks 5.85.0

The attached test.4445.ts file is considered audio/vnd.dts.hd with Frameworks 5.84.0 and below (tested 5.84.0, 5.83.0, 5.80.0)

With 5.85.0 the file is considered to be text/vnd.qt.linguist or text/vnd.trolltech.linguist (*)

Carefully taking a step back though...

The mimetype ought to be video/mp2t (as per Bug 440632), this is just a failure mode.
Comment 4 tagwerk19 2021-08-10 22:12:40 UTC
It seems that the shared-mime-info (freedesktop.org.xml) file included in Neon Testing is release 2.0, or at least it does not include the

    Make text/vnd.trolltech.linguist the canonical name for text/vnd.qt.linguist

change in release 2.1
Comment 5 tagwerk19 2021-08-11 13:37:21 UTC
(In reply to tagwerk19 from comment #3)
> Looks like a regression with KDE Frameworks 5.85.0
> 
> The attached test.4445.ts file is considered audio/vnd.dts.hd with
> Frameworks 5.84.0 and below (tested 5.84.0, 5.83.0, 5.80.0)
No. Scrub that :-/

Have an instance of a Frameworks 5.84.0 system giving text/vnd.qt.linguist (Neon User) and another 5.84.0 (SUSE Tumbleweed) giving audio/vnd.dts.hd

I don't see a pattern, no correlation with version of Plasma, Frameworks or Qt.

However an older Neon User

    Plasma: 5.22.0
    Frameworks: 5.83.0
    Qt: 5.15.3

returned audio/vnd.dts.hd. When it was updated to

    Plasma: 5.22.4
    Frameworks: 5.84.0
    Qt: 5.15.3

it returned text/vnd.qt.linguist.

Sorry, cannot help more than that.
Comment 6 David Faure 2022-05-04 08:35:40 UTC
$ kmimetypefinder5 test.4445.ts 
video/mp2t

$ kmimetypefinder5 -c test.4445.ts
video/mp2t

This is the expected result, right?

What do you get?
Do you have interference from bogus mimetype definitions? Find out with `grep -rwl '\*.ts' ~/.local/share/mime/packages /usr/share/mime/packages` which should only say /usr/share/mime/packages/freedesktop.org.xml
Comment 7 tagwerk19 2022-05-04 20:31:38 UTC
(In reply to David Faure from comment #6)
> This is the expected result, right?
I think so.
 
> What do you get?
I've just tried this with a couple of Fedora betas...

With Fedora 36 beta (Gnome), I get:

    $ xdg-mime query filetype test.4445.m2ts
    video/mp2t
    $ xdg-mime query filetype test.4445.ts
    video/mp2t
    $ xdg-mime query filetype test.4445
    video/mp2t

Which looks as I think it should. However with Fedora 36 KDE beta I get the strange:

    $ kmimetypefinder test.4445.m2ts
    video/mp2t
    $ kmimetypefinder test.4445.ts
    text/vnd.qt.linguist
    $ kmimetypefinder test.4445
    audio/vnd.dts.hd

I get the same when querying with xdg-mime instead of kmimetypefinder and also when using Neon Testing. Getting different results from two spins of one distro is interesting. I'll rerun the tests when F36 is properly released

In each case:

    $ grep -rwl '\*.ts' ~/.local/share/mime/packages /usr/share/mime/packages
    grep: /home/test/.local/share/mime/packages: No such file or directory
    /usr/share/mime/packages/freedesktop.org.xml

The two spins of Fedora have the same freedesktop.org.xml (shared-mime-info-2.1-3.fc35.x86_64).

I think "wierd" and it would be nice to debug messages from kmimetypefinder...
Comment 8 tagwerk19 2022-05-04 21:02:39 UTC
(In reply to David Faure from comment #6)
> $ kmimetypefinder5 -c test.4445.ts
Sorry I missed the '-c' option, I get "audio/vnd.dts.hd" for all three files (on Fedora 36 KDE beta)
Comment 9 tagwerk19 2022-05-05 09:17:35 UTC
(In reply to tagwerk19 from comment #7)
> ... also when using Neon Testing.
OK, not quite true

With Fedora KDE, for test.4445.ts, I get:
    text/vnd.trolltech.linguist
and for Neon Testing, I get:
    text/vnd.qt.linguist

The Neon Testing still shows shared-mime-info being version 1.15.-1
Comment 10 tagwerk19 2022-05-20 17:47:48 UTC
(In reply to tagwerk19 from comment #7)
> I'll rerun the tests when F36 is properly released
Revisiting...

F36 still seems to have the shared-mime-info-2.1.3.fc35.x86_64 package

With Fedora Workstation 36 (Gnome), a new install of Fedora-Workstation-Live-x86_64-36-1.5.iso, I get:

    $ xdg-mime query filetype test.4445.m2ts
    video/mp2t
    $ xdg-mime query filetype test.4445.ts
    video/mp2t
    $ xdg-mime query filetype test.4445
    video/mp2t

Which I feel is as it should be.

With Fedora 36 KDE, a new install of Fedora-KDE-Live-x86_64-36-1.5.iso, I get:

    $ kmimetypefinder test.4445.m2ts
    video/mp2t
    $ kmimetypefinder test.4445.ts
    text/vnd.trolltech.linguist
    $ kmimetypefinder test.4445
    audio/vnd.dts.hd

And with the "-c" argument:

    $ kmimetypefinder -c test.4445.m2ts
    audio/vnd.dts.hd
    $ kmimetypefinder -c test.4445.ts
    audio/vnd.dts.hd
    $ kmimetypefinder -c test.4445
    audio/vnd.dts.hd

The test file satisfies the "magic" for both video/mp2t and audio/vnd.dts.hd

    $ od -c test.4445.ts
    0000000  \0  \0  \0  \0   G  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    0000020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    *
    0000300  \0  \0  \0  \0   G  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    0000320  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    *
    0000600  \0  \0  \0  \0   G  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    0000620  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    *
    0001100  \0  \0  \0  \0   G  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    0001120  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    *
    0001400  \0  \0  \0  \0   G  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    0001420  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
    *
    0010520  \0  \0  \0  \0  \0  \0  \0  \0  \0   d   X       %
    0010535
Comment 11 Stefan Brüns 2023-07-05 17:53:45 UTC
Not a kfilemetadata bug, but SMI. Anyway, seems to be fixed upstream.