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:
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.
File "/tmp/test_empty" has a mime-type of application/x-zerosize
File "/tmp/test_empty" has a mime-type of text/plain
Here is the commit from last September:
"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))
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.
on Jul 23, 2016 at 19:15:58.
(provided by the Example extension).