http://bugs.winehq.org/show_bug.cgi?id=28158
Summary: [integration] winemenubuilder forces lower case when searching fd.o mime database Product: Wine Version: 1.3.26 Platform: x86 OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: programs AssignedTo: wine-bugs@winehq.org ReportedBy: wine@rodrigosilva.com
When winemenubuilder searches for freedesktop.org xdg mime database, and build its list native extensions and mime types, it always searches and tries to match a lower case string. Windows registry might be case-insensitive, but native mime database is not, and (unfortunately) some extensions (globs) and mime types do have upper case chars. Some examples:
audio/AMR:*.amr audio/AMR-WB:*.awb text/x-c++src:*.C application/x-compress:*.Z application/x-blender:*.BLEND text/x-iMelody:*.ime text/x-iMelody:*.imy text/css:*.CSSL application/x-gnome-saved-search:*.savedSearch
I am just listing "regular" globs that could be directly mapped to windows extensions (as opposed to things like README*, Makefile, *.tar.Z, etc)
Take Z for an example of the problem:
- Windows app register "HKCR.z". Winemenubuilder searches for *.z, can't match, so it creates the native application/x-wine-extension-z mime/glob. Unfortunate but unavoidable.
- Windows app register "HKCR.Z" instead. Winemenubuilder *still* searches for *.z, because it forces lowercase in its search! There is no match, and it creates the application/x-wine-extension-z. With *.z glob! And that is a bug.
Currently, there is no way to prevent winemenubuilder to create duplicate (and buggy) mime extensions when native glob and/or extension contains upper (or mixed) case chars.
My suggestion for fix: to really mimic Registry case-insensitivity behavior, winemenubuilder should use case-insensitive search. For example, comparing lower(win ext)=lower(fd.o glob). And if a match is not found, create the native glob *exactly* as registered by windows app.
http://bugs.winehq.org/show_bug.cgi?id=28158
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |adys.wh@gmail.com
--- Comment #1 from Jerome Leclanche adys.wh@gmail.com 2011-08-22 18:56:54 CDT --- winemenubuilder already forces lowercase mimetype registration (see commit 44527f57b2c4722b3317b2a03ba6b1d2ac7fc538). Did you try on a clean prefix?
http://source.winehq.org/git/wine.git/commitdiff/44527f57b2c4722b3317b2a03ba...
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #2 from Jerome Leclanche adys.wh@gmail.com 2011-08-22 18:57:20 CDT --- By prefix I mean prefix and empty mime database.
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #3 from MestreLion wine@rodrigosilva.com 2011-08-22 19:34:38 CDT --- (In reply to comment #1)
winemenubuilder already forces lowercase mimetype registration (see commit 44527f57b2c4722b3317b2a03ba6b1d2ac7fc538). Did you try on a clean prefix?
http://source.winehq.org/git/wine.git/commitdiff/44527f57b2c4722b3317b2a03ba...
The problem is that not all *NATIVE* mimetypes/extensions are lower case. The examples i gave were not created by wine. They are are existing (and valid) extensions in my native system. And wine incorrectly never finds them.
I dont mind winemenubuilder creating lowercase mimetypes... but it should be able to *find* existing non-lowercase native mimetypes/globs before creating duplicate, redundant (and buggy) ones.
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #4 from Jerome Leclanche adys.wh@gmail.com 2011-08-22 19:39:27 CDT --- (In reply to comment #3) I'm not sure what you mean. Doesn't winemenubuilder look through the registry, which is case-insensitive?
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #5 from MestreLion wine@rodrigosilva.com 2011-08-22 19:44:12 CDT --- By the way, that commit is buggy (or incomplete): it only lowercase windows extension in generate_associations(), while it allows mixed-case in both build_native_mime_types() and freedesktop_mime_type_for_extension()
So it fails to find that *.Z is currently associated with application/x-compress and *.amr to audio/AMR in my *native* mime database, and creates duplicate entries for those, no matter how they are registered in windows.
http://bugs.winehq.org/show_bug.cgi?id=28158
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |damjan.jov@gmail.com
--- Comment #6 from Jerome Leclanche adys.wh@gmail.com 2011-08-22 19:46:59 CDT --- (In reply to comment #5) Yeah, I thought so after looking at the bug.
CCing Damjan as he knows winemenubuilder much better than I do.
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #7 from MestreLion wine@rodrigosilva.com 2011-08-22 19:47:28 CDT --- The registry is case-insensitive, but winemenubuilder is not! Problem is that native system is not... winemenubuilder should be able to correctly find mimetype for .Z
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #8 from MestreLion wine@rodrigosilva.com 2011-08-22 20:35:42 CDT --- (In reply to comment #6)
(In reply to comment #5) Yeah, I thought so after looking at the bug.
CCing Damjan as he knows winemenubuilder much better than I do.
If you and Damjan are familiar with winemenubuilder, i BEG for the two of you to also take a look in 2 very similar and related bugs:
http://bugs.winehq.org/show_bug.cgi?id=28159 http://bugs.winehq.org/show_bug.cgi?id=28160
They are both about the way winemenubuilder handles associations in registry/native.
I am developing a script (may become an app, or part of winecfg) to register native extensions in wine (the opposite of what winemenubuilder does). But winemenubuilder's current behavior in these 3 bugs makes that an impossible task.
If my suggestions are implemented in winemenubuilder, true bidirectional integration with Wine Apps and Native Apps will be possible, without loops or issues.
That would be a huge feature for wine, IMHO
http://bugs.winehq.org/show_bug.cgi?id=28158
Dmitry Timoshkov dmitry@baikal.ru changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |integration Summary|[integration] |winemenubuilder forces |winemenubuilder forces |lower case when searching |lower case when searching |fd.o mime database |fd.o mime database |
http://bugs.winehq.org/show_bug.cgi?id=28158
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #9 from Damjan Jovanovic damjan.jov@gmail.com 2011-08-23 01:34:25 CDT --- Filename extension case sensitivity was written with the assumption that on Windows it is case insensitive while on *nix it is case sensitive. That's why we lowercase in some cases - to force everything into the common *nix case.
If you're saying Windows does case sensitive matching, then yes, winemenubuilder needs to be fixed.
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #10 from MestreLion wine@rodrigosilva.com 2011-08-23 08:31:25 CDT --- (In reply to comment #9)
Filename extension case sensitivity was written with the assumption that on Windows it is case insensitive while on *nix it is case sensitive. That's why we lowercase in some cases - to force everything into the common *nix case.
If you're saying Windows does case sensitive matching, then yes, winemenubuilder needs to be fixed.
Im glad to hear from you, Damjan, as i truly admire all the hard work you put on winemenubuilder... i've been studing its source code, and its a phenomenal tool.
The issue is not about associations within windows. Its about the bridge that winemenubuilder does in native associations. More precisely, functions build_native_mime_types() and freedesktop_mime_type_for_extension(). They should also lowercase native extensions.
Currently, if a windows app registers .z (or .Z, or .amr), winemenubuilder will not find the corresponding native mimetypes application/x-compress (or audio/AMR), and it **will think those extensions dont exist in native system!*** and will create new, redundant mimetypes for them.
Not only that, but the new mimetypes and .desktop entries will not work the way they should: native apps will not be able to open .Z files, because x-wine-extension-z.desktop wont handle them
winemenubuilder is a bridge between windows and native. So it should force lowercase for all incoming extensions (meaning build_native_mime_types() should lowercase fd.o entries when building the list) for truly case-insensitiveness to work correctly. And it should use proper case when creating .desktop and mime.xml files in native system.
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #11 from MestreLion wine@rodrigosilva.com 2011-08-23 08:54:49 CDT --- (In reply to comment #9)
Filename extension case sensitivity was written with the assumption that on Windows it is case insensitive while on *nix it is case sensitive.
Thats a great and correct assumption, and Im not against it. But its not working that way right now.
That's why we lowercase in some cases - to force everything into the common *nix case.
So why not lower case in build_native_mime_types()? If you lowercase one side and not the other, and then compare them, it wont match. So currently windows is not being case-insensitive when looking for existent mimetypes in fd.o mime database
Being case-insensitive means .z in windows should accept either *.z or *.Z as their corresponding native globs.
In general, to achieve the assumption, use lowercase when *reading* from *nix, and proper (original) case when *writing* to it.
So: - build_native_mime_types() - lowercase - freedesktop_mime_type_for_extension() - lowercase - match_glob - lowercase - write_freedesktop_mime_type_entry() - original case - write_freedesktop_association_entry() - original case
http://bugs.winehq.org/show_bug.cgi?id=28158
Damjan Jovanovic damjan.jov@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|wine-bugs@winehq.org |damjan.jov@gmail.com
--- Comment #12 from Damjan Jovanovic damjan.jov@gmail.com 2011-08-23 13:36:36 CDT --- Created an attachment (id=36084) --> (http://bugs.winehq.org/attachment.cgi?id=36084) Lowercase the glob
Does this patch do what you want?
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #13 from MestreLion wine@rodrigosilva.com 2011-08-24 15:33:18 CDT --- (In reply to comment #12)
Created an attachment (id=36084)
--> (http://bugs.winehq.org/attachment.cgi?id=36084) [details]
Lowercase the glob
Does this patch do what you want?
I didnt have the time to run the patch and test it, but by looking at it, yes, it seems like a great step in the right direction.
A general guideline to accomplish case insensitiveness inside windows and proper case when dealing with native associations and mime types could be this:
- When winemenubuilder tries to find if windows ext exists in native system, it should do matches like "for each ext in native-list do... if lower(ext) == lower(native) ... match"
- When writing to native system (.desktop or mime), use the same case as in the registry... be it lower, upper or mixed case.
Last but not least... if you want to, i could try to write a patch myself... i just want to hear your opinion on the subject. My programming skills are quite limited, but i would gladly try to do that if you say "ok, i agree, go ahead"
Is this solution, about dealing with mixed case exts and mimes, something you agree with?
Also, could you please also say what is your opinion about bugs # 28159 and 28160 ?
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #14 from Austin English austinenglish@gmail.com 2013-11-13 16:50:24 CST --- This is your friendly reminder that there has been no bug activity for 2 years. Is this still an issue in current (1.7.6 or newer) wine? If so, please attach the terminal output in 1.7.6 (see http://wiki.winehq.org/FAQ#get_log).
http://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #15 from Jerome Leclanche adys.wh@gmail.com 2013-11-15 14:36:15 CST --- Damjan?
https://bugs.winehq.org/show_bug.cgi?id=28158
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |ABANDONED
--- Comment #16 from Austin English austinenglish@gmail.com --- Abandoned.
https://bugs.winehq.org/show_bug.cgi?id=28158
Jerome Leclanche adys.wh@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|ABANDONED |---
--- Comment #17 from Jerome Leclanche adys.wh@gmail.com --- Hold your jackets :)
https://bugs.winehq.org/show_bug.cgi?id=28158
super_man@post.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |super_man@post.com
--- Comment #18 from super_man@post.com --- The patch doesnt apply cleanly anymore
1.7.51
https://bugs.winehq.org/show_bug.cgi?id=28158
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
https://bugs.winehq.org/show_bug.cgi?id=28158
--- Comment #19 from Damjan Jovanovic damjan.jov@gmail.com --- (In reply to super_man from comment #18)
The patch doesnt apply cleanly anymore
1.7.51
The patch was committed long ago:
commit 01d5a0f53b3bf03f8e6cd40dab019c2cdad18ef8 Author: Damjan Jovanovic damjan.jov@gmail.com Date: Sun Aug 28 21:21:46 2011 +0200
winemenubuilder: Do case-insensitive glob comparisons.
https://bugs.winehq.org/show_bug.cgi?id=28158
Neko-san nekoNexus@protonmail.ch changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |nekoNexus@protonmail.ch