GNOME Bugzilla – Bug 514306
Many Metacity themes contain invalid XML
Last modified: 2015-02-09 23:05:28 UTC
Bear with me while I explain the background a little: Metacity themes ("metacity-theme-1.xml") are theoretically XML files. In practice Metacity parses them using GMarkup, which isn't a fully-featured XML parser; in particular it allows some things as valid which are not valid XML. Even among people who understand XML, it is not always well-known that two hyphens appearing in sequence in a comment will cause havoc. (This is because XML comments are in fact SGML processing instructions, which begin with "<!" and end with ">"; within these, there can be comments delimited with "--", so the full result is that "<!--" ... "-->" will allow you to add comments to an XML file.) However, GMarkup, not being a fully-featured XML parser, does not work this way, and believes that comments begin at "<!--" and go on until the next "-->". Arguably, this may be considered a bug in GMarkup, but GMarkup is not supposed to be a complete XML implementation anyway. So, to the point: there are at least five themes on a.g.o (c2, Chiro, MetaGrip, Vista Basic) which use a double hyphen inside a comment. c2 and Chiro do so merely in order to draw a line across their markup, thus: <!------------------------------------------------------------------> The others do so in order to nest comments, which is clearly illegal. The point of this bug is that it is unhelpful for these files to be invalid XML. It means it is very hard to write tests and editors, as I'm trying to do as a Metacity maintainer. The fixes for each test would be trivial and I'm entirely willing to provide patches. But perhaps, on the other hand, theme authors don't want their themes messed with, and we could say that any theme which Metacity can interpret is a valid theme.
FWIW, GMarkup's policy is that invalid XML is invalid GMarkup even if GMarkup can parse it. http://library.gnome.org/devel/glib/unstable/glib-Simple-XML-Subset-Parser.html#ftn.wellformed
GtkSourceView 2.0 uses libxml and relax-ng validation on runtime to spit out warnings at runtime when using a malformed syntax file. I'm not sure validating a file each time you use it is the best way to do things, but at least we don't have invalid lang files in gsv2 ;-)
So, which ones need patches? And in which modules do those live?
c2 and Chiro contain decorations of the form <!------------------------------------------------------------------> MetaGrip and Sloth contain nested comments. I will provide patches this evening.
Surely it would be easy to fix this?
Chris: are you volunteering?
Sure. How hard can it be to remove lines like the following: <!------------------------------------------------------------------> How do I start?
Chris: the easiest thing to do would be if you could download the broken themes, fix them, then upload the fixed themes as attachments to this bug. I can then upload them to art.gnome.org from here.
Anyone looking into fixing these themes? Seems fairly trivial to fix, so adding gnome-love keyword.
http://github.com/ju2wheels/metacitythemepatches
Created attachment 171385 [details] [review] Chiro patch
Created attachment 171386 [details] [review] c2 patch
Created attachment 171387 [details] [review] Vista Basic patch
Created attachment 171388 [details] [review] Metagrip patch
Created attachment 171389 [details] VistaBasic w/ patch applied
Created attachment 171390 [details] MetaGrip w/patch applied
Created attachment 171391 [details] Chiro w/ patch applied
Created attachment 171392 [details] C2 w/ patch applied
art.gnome.org is not under development anymore. Closing this report as OBSOLETE.