Bug 15363 - graphviz' dot files mime type
Summary: graphviz' dot files mime type
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Jonathan Blandford
QA Contact:
URL:
Whiteboard:
Keywords:
: 12677 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-05 05:56 UTC by Paolo Borelli
Modified: 2008-10-17 08:03 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch (751 bytes, patch)
2008-04-05 05:58 UTC, Paolo Borelli
Details | Splinter Review
same patch + testcase (1.50 KB, patch)
2008-04-07 05:45 UTC, Paolo Borelli
Details | Splinter Review
alternative patch (1.51 KB, patch)
2008-04-07 05:47 UTC, Paolo Borelli
Details | Splinter Review

Description Paolo Borelli 2008-04-05 05:56:59 UTC
Add a mime type for Graphviz dot scripts.
Comment 1 Paolo Borelli 2008-04-05 05:58:22 UTC
Created attachment 15697 [details] [review]
patch
Comment 2 Bastien Nocera 2008-04-07 02:52:57 UTC
I'd rather text/x-graphviz, and the patch is missing a test case, and being added to the tests/list
Comment 3 Paolo Borelli 2008-04-07 05:45:01 UTC
Created attachment 15737 [details] [review]
same patch + testcase

Same patch with testcase added. I think text/x-dot is better than x-graphviz: graphviz is a collection of tools, but there are also other tools that deal with dot files and the documentaion at http://www.graphviz.org/doc/info/lang.html explicitely refers to the syntax as "the DOT language".

That said, I'll also attach another patch using x-graphviz and let you pick the one you prefer.
Comment 4 Paolo Borelli 2008-04-07 05:47:50 UTC
Created attachment 15738 [details] [review]
alternative patch
Comment 5 Bastien Nocera 2008-04-09 03:28:46 UTC
Could you add some magic to the matchlet as well?
From the URL you gave, the file should start with:
"strict graph "
"graph "
"strict digraph "
"digraph "
Comment 6 Pino Toscano 2008-04-10 02:17:27 UTC
*** Bug 12677 has been marked as a duplicate of this bug. ***
Comment 7 David Faure 2008-04-10 02:27:19 UTC
Please note that .dot files are also msword templates, we need a
mimetype for that one too, with *.dot as a pattern, and magic to differenciate
it from graphviz files (well I guess it could just inherit application/x-ole-storage).
Comment 8 Bastien Nocera 2008-04-10 06:24:22 UTC
(In reply to comment #7)
> Please note that .dot files are also msword templates, we need a
> mimetype for that one too, with *.dot as a pattern, and magic to differenciate
> it from graphviz files (well I guess it could just inherit
> application/x-ole-storage).

Made it a sub-class of application/msword instead. Added to the test suite.
Comment 9 Paolo Borelli 2008-04-11 05:51:38 UTC
With your last change, graphviz dot files are now detected as MS files :(

Shouldn't the test suite also check that the dot file I attched is *not* detected as a MS dot file? (and vice versa, that MS test file is not detected as graphiz dot file)

As for the magic pattern for graphviz dot files, I have no clue how it should be done...

is something like this enough?

<match type="string" value="graph" offset="0"/>
<match type="string" value="digraph" offset="0"/>


It really sounds wrong to me since like all source files, most of the time the file starts with comments...
Comment 10 Bastien Nocera 2008-04-11 05:54:16 UTC
(In reply to comment #9)
> With your last change, graphviz dot files are now detected as MS files :(

Obviously, since I didn't commit your patch!

> Shouldn't the test suite also check that the dot file I attched is *not*
> detected as a MS dot file? (and vice versa, that MS test file is not detected
> as graphiz dot file)

Yes, once we have added your patch.

> As for the magic pattern for graphviz dot files, I have no clue how it should
> be done...
> 
> is something like this enough?
> 
> <match type="string" value="graph" offset="0"/>
> <match type="string" value="digraph" offset="0"/>
> 
> 
> It really sounds wrong to me since like all source files, most of the time the
> file starts with comments...

Then look for it in 0:256, or something like that. And please provide a representative .dot file then.
Comment 11 Paolo Borelli 2008-04-11 05:58:00 UTC
>> With your last change, graphviz dot files are now detected as MS files :(

>Obviously, since I didn't commit your patch!

mmm... I thought that for binary files *not* matching the magic regex would prevail over a matching glob, otherwise simply renaming junk to .doc etc would make it detected as MS file, no?
Comment 12 Bastien Nocera 2008-04-11 06:04:21 UTC
(In reply to comment #11)
> >> With your last change, graphviz dot files are now detected as MS files :(
> 
> >Obviously, since I didn't commit your patch!
> 
> mmm... I thought that for binary files *not* matching the magic regex would
> prevail over a matching glob, otherwise simply renaming junk to .doc etc would
> make it detected as MS file, no?

Which is what it does. Read the shared-mime spec for more information about the detection algorithms.
Comment 13 Sebastian Dröge (slomo) 2008-05-28 22:56:39 UTC
Any news on this?
Comment 14 Bastien Nocera 2008-06-11 08:18:13 UTC
(In reply to comment #13)
> Any news on this?

I'm still waiting on a patch with decent magic.
Comment 15 David Faure 2008-10-17 08:03:34 UTC
In fact this mimetype has been registered to IANA recently (July 2008), under the name text/vnd.graphviz. Good thing we didn't have it in freedesktop.org yet, so we can use the right name for it now ;)

I just committed the definition of text/vnd.graphviz, with globs from IANA (*.gv, *.dot), magic (determined using the dot files I had around), and test (from Paolo Borelli).


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.