Testing xdg-mime on large number of files

Bastien Nocera hadess at hadess.net
Thu Sep 27 05:06:47 PDT 2012


Em Wed, 2012-09-26 às 02:22 +0400, Сергей Давыдов escreveu:
>         I've added a test program to xdgmime (that's where the code
>         lives) to
>         print out the mime-type of files gathered "by name", "by data"
>         and "by
>         file". Expanding it to print out mismatches to a separate file
>         would be
>         fairly straight forward, and avoid having to use hard links at
>         all.
> 
> I imagine it would be easy to make it recursive in a shell loop over
> "tree -dif ." or "find . -type d -print".
> 
> It would be nice if the script could report mismatches to stderr; it
> would be easy to sort them from that point on. Also, it might be a
> good idea to not complain about mime types that are impossible to
> detect by content, like ISO 9660, LZMA archives, etc. so you don't
> receive any useless bug reports about them.

The problem is that we have no way using the xdgmime API to know whether
a particular mime-type has magic data associated to it, and even then,
it might not be the mime-type itself but one of its parents that has
magic data defined. So we can't really make that assumption.

> By the way, print-mime-data hangs up when it encounters a named pipe.
> My script does not because it skips everything that's not a regular
> file. And xdg-mime reports it as "inode/fifo".

I made it ignore non-regular files now.

> 
>         Thanks for your bug reports, feel free to keep them coming.
> 
> And thank you for fixing the bugs!
> 
> In fact I've reported the mp3 bug
> (https://bugs.freedesktop.org/show_bug.cgi?id=55250) to Ubuntu bug
> tracker back in 2009, and it was never forwarded to FD.o bug tracker;
> there are lots unattended bugs still hanging at
> https://bugs.launchpad.net/ubuntu/+source/shared-mime-info 
> I guess I'll forward everything that's still relevant to the FD.o bug
> tracker now.

Would be useful.

Would be great if you could follow the HACKING file for new mime-types.
Without test cases, I would really rather not add new types, otherwise
we risk creating regressions...

Cheers




More information about the xdg mailing list