Bug 55120 - application/x-zerosize isn't supported when not using cache.
Summary: application/x-zerosize isn't supported when not using cache.
Status: RESOLVED MOVED
Alias: None
Product: xdgmime
Classification: Unclassified
Component: xdgmime (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-19 20:07 UTC by Norm Pierce
Modified: 2018-10-13 10:33 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Norm Pierce 2012-09-19 20:07:39 UTC
Last September support was implemented for the application/x-zerosize MIME type.  This works fine when there is support for loading the mime.cache file into shared memory (and the file exists), but not otherwise.

To reproduce, create an empty file that doesn't match any glob.  For instance:

touch /tmp/test_empty

Then hide all of your mime.cache files ($HOME/.local/share/mime/mime.cache, /usr/share/mime/mime.cache, /usr/local/share/mime/mime.cache) and run test-mime on the empty file.

Expected results:
File "/tmp/test_empty" has a mime-type of application/x-zerosize

Actual results:
File "/tmp/test_empty" has a mime-type of text/plain

Here is the commit from last September:

http://cgit.freedesktop.org/xdg/xdgmime/commit/?id=5181175d5fdaa3832b0fd094cda0120b1fe92af6
"xdg/xdgmime: Implement text vs binary fallback; support for application/x-zerosize"

Looking at the commit diff for xdgmimecache.c, you can see where

+  if (statbuf->st_size == 0)
+    return XDG_MIME_TYPE_EMPTY;
+

has been added just before the existing

   if (!S_ISREG (statbuf->st_mode))
     return XDG_MIME_TYPE_UNKNOWN;

in _xdg_mime_cache_get_mime_type_for_file().

To fix this bug, the same code also needs to be added to the general version of that function, xdg_mime_get_mime_type_for_file(), in xdgmime.c.
Comment 1 GitLab Migration User 2018-10-13 10:33:44 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/xdgmime/issues/8.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.