[rfc][icedtea-web] PolicyEditor gains a real parser

Jacob Wisor gitne at gmx.de
Wed Dec 31 18:33:00 UTC 2014

On 12/26/2014 at 08:09 PM Andrew Azores wrote:
> Hi all,
> Long time no see!
> I started this patch several months ago, but my school work became far 
> too heavy and I had to put off any further work to finish off this 
> patch. Today I've managed to finish it to a point that I think it's 
> worth submitting for review.
> It's a big, long patch, so review will probably take quite some time, 
> and may be difficult at times. I know I've appeared to be completely 
> gone for many weeks, but I have actually been checking on my emails 
> fairly often, just haven't had time to reply to any patch reviews. But 
> right now I should have at least a few weeks before school really picks 
> back up again.
> The gist of this patch is basically that I discovered that policytool's 
> parser is actually available to use without any dirty reflection hacks 
> or anything like that, but it's hidden away and not really documented, 
> and is marked as an internal API. But it's open and so I think the worst 
> case scenario if it's removed later is that we just fork and maintain an 
> older copy. It's much easier and IMHO smarter than writing a whole new 
> parser from scratch to duplicate the one that policytool uses, anyhow. 
> This patch just rips out the old, crappy code that used horrible regex 
> to try to parse policy files, and plops in the policytool parser 
> instead. Anything else pretty much comes down to reconciling the 
> existing PolicyEditor code and structures with the new ones that the 
> parser gives and expects.
> Nice side effect: all policyeditor tests now pass, even the tricky 
> comments handling ones ;)

Although I have not reviewed the patch, I have to admit it is a good idea for
PolicyEditor and policytool to share the same configuration file and Format
(and parser code).
However, I have always found policytool's file format very odd and doll to
parse. In some sense it is quite "proprietary", except for conforming to ASCII.
So, even though it is simple text it is not based on any other standard like
SGML or XML. It is not even based on Java's "all-purpose" properties file
format. I do not know if there is any need for this or how many people may be
affected, but would you like to give it some thought developing a XML (with
schema) or properties file format for policytool's and PolcyEditor's purpose?
This new file format and parser could be added as an extension to policytool
and PolicyEditor in the future. There is no need to drop support for
policytool's current file format, but there certainly is still room for
improvement. What do you think?


More information about the distro-pkg-dev mailing list