.xo bundles (was Re: #1803 HIGH Trial-2: Add Chat activity to builds)

Tomeu Vizoso tomeu at tomeuvizoso.net
Wed Jul 4 15:40:12 EDT 2007


On Wed, 2007-07-04 at 15:16 -0400, John (J5) Palmieri wrote:
> On Wed, 2007-07-04 at 20:39 +0200, Tomeu Vizoso wrote:
> > On Wed, 2007-07-04 at 14:18 -0400, John (J5) Palmieri wrote:
> > > BTW We now have an official registered mime type "vnd.olpc-sugar" which
> > > specifies "XO" as the magic key to identify the mime type.  At some
> > > point the PK in the zip header will change to XO. 
> > 
> > Hmm, I was thinking about doing something similar to what OpenDocument
> > does by storing a mimetype file uncompressed on the root of the archive.
> > 
> > In this way we can sniff the mime type while retaining full
> > compatibility with zip files. Also, we can sniff for different kinds of
> > bundles, if we reserve vnd.olpc-sugar for activity bundles.
> 
> That is fine but the magic bit makes it easier for others and doesn't
> remove compatibility from zip tools.  They just spit out a warning. BTW
> in fedora .ods files are opening up as zip archive.  That is clearly
> wrong. 

Ok, cool. I see both approaches good enough, but if asked which is
better, I would go with the opendocument-like because:

- it can be built easily with standard tools that you can find in almost
every system, without messing with the binary file,
- it can be sniffed as easily (the mime type can be found at the 38th
byte),
- is more extensible than a two-digit code.

Regarding the issues in fedora, we're using xdgmime and it checks
correctly that some zip files are opendocument files:

  <mime-type type="application/vnd.oasis.opendocument.text">
    <sub-class-of type="application/zip"/>
    <_comment>ODT document</_comment>
    <acronym>ODT</acronym>
    <expanded-acronym>OpenDocument Text</expanded-acronym>
    <magic priority="50">
      <match type="string" value="PK\003\004" offset="0">
        <match type="string" value="mimetype" offset="30">
          <match type="string" value="application/vnd.oasis.opendocument.text" offset="38"/>
        </match>
      </match>
    </magic>
    <glob pattern="*.odt"/>
  </mime-type>

Showing a .xo or .odt file as a zip file is much better than showing it
as an unknown binary file.




More information about the Devel mailing list