After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 782180 - commit "Improve GContentType" usage breaks apps on win32 (example: virt-viewer)
commit "Improve GContentType" usage breaks apps on win32 (example: virt-viewer)
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
3.22.x
Other Windows
: Normal major
: ---
Assigned To: gtk-bugs
Emmanuele Bassi (:ebassi)
Depends on:
Blocks:
 
 
Reported: 2017-05-04 19:36 UTC by hfp
Modified: 2017-05-11 21:26 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description hfp 2017-05-04 19:36:02 UTC
https://github.com/GNOME/gtk/commit/47f4e44aec91cba0d8d2a7b0071b23134335065f

In the following code

filter_content_type = g_content_type_from_mime_type (filter_info->mime_type);
rule_content_type = g_content_type_from_mime_type (rule->u.mime_type);
match = g_content_type_is_a (filter_content_type, rule_content_type);

you get assertions because g_content_type_from_mime_type will lookup the registry and return NULL if this type is not in the win32 registry. Then you will assert in g_content_type_is_a

Doesn't using content types break the "mime"-filter anyway?
Comment 1 Patrick Griffis (tingping) 2017-05-08 19:15:57 UTC
I will just say the patch is correct usage of the API so if it ever worked before I would call that a bug. It not working now is indeed simply up to the Win32 backend either not knowing the type or a bug in that backend.
Comment 2 hfp 2017-05-09 20:49:45 UTC
What kind of communication style is this? Not answering my question about a MIME filter (not a content type filter) and then closing as fixed?
Comment 3 Patrick Griffis (tingping) 2017-05-09 20:59:26 UTC
Well I didn't close it so no idea about that.

As for the question the concept of a "mime type" is not portable, Linux has a giant shared-mime-info database of mime types that packages can extend and whatnot. So Gio with the goal of being portable has to map that to an opaque "ContentType" that is more native to the platform. The fact Gtk directly exposes the concept of a mimetype is a shame but it is correct in trying to convert it to a contenttype.
Comment 4 Patrick Griffis (tingping) 2017-05-09 21:03:14 UTC
Anyway if you want this issue to actionable you need to say what mime type you are trying to filter on so somebody can look into what the Win32 backend is failing to do and why it *ever* worked before.
Comment 5 hfp 2017-05-09 21:06:57 UTC
Sorry, but MIME types are very portable as they are an official internet standard (RFC) (see https://tools.ietf.org/html/rfc2046) without any platform (win32/linux/...) dependency.
Comment 6 Matthias Clasen 2017-05-11 15:52:53 UTC
(In reply to hfp from comment #2)
> What kind of communication style is this? Not answering my question about a
> MIME filter (not a content type filter) and then closing as fixed?

The communication style assumes that you know how to use git.
It was fixed by this commit:

https://git.gnome.org/browse/gtk+/commit/?id=95e313a2833fcf2d80f0b298aaf2b533642b0198
Comment 7 Matthias Clasen 2017-05-11 15:53:44 UTC
If there is a problem with the win32 contentype implementation, please file it against glib. Thanks
Comment 8 hfp 2017-05-11 21:26:50 UTC
You should not use content types in this case at all. The code says "case FILTER_RULE_MIME_TYPE" and not "case FILTER_RULE_CONTENT_TYPE".
And MIME types with the "x-" prefix are private extensions and do not need registration.