Skip to content

text/x-qml: Lower match priority to avoid conflicts with Python

Philip Withnall requested to merge pwithnall/shared-mime-info:84-qml into master

GLib takes priorities >= 80 to mean a short-circuit to a magic match, overriding any conflicting matching globs. More generally, high priority magic should only be used if it’s really unlikely that the magic will match anything except the given MIME type. That’s evidently not true here.

Some Python files which import Qt modules can look like valid QML files, matching the magic but not the glob.

Lower the priority of the magic so that it doesn’t trigger the short-circuit code in GLib. This means the name match is guessed as the right one instead of the magic match.

See https://gitlab.gnome.org/GNOME/glib/-/blob/6ee71750a532d8de5eaed5cf12e8718738ddd5c6/gio/gcontenttype.c#L840 and https://gitlab.gnome.org/GNOME/glib/-/issues/2599.

Tested with XDG_DATA_DIRS=$buildroot/share gio info ./not-qml.py.

Signed-off-by: Philip Withnall pwithnall@endlessos.org

Helps: #84 (closed)

Closes #84 (closed)

Merge request reports