[PATCH v2 3/3 wayland] Validate the protocol xml during scanning

Pekka Paalanen ppaalanen at gmail.com
Tue Nov 17 04:57:14 PST 2015


On Tue, 10 Nov 2015 09:53:08 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:

> Embed the wayland.dtd protocol data into the scanner binary so we can validate
> external protocol files without requiring makefile changes. Hat-tip to Pekka
> Paalanen for the embedding trick.
> The embedding trick doesn't work well if the to-be-embedded file is in a
> different location than the source file, so copy/link it during configure and
> then build it in from the local directory.
> 
> The current expat parser is not a validating parser, moving scanner.c to
> another parser has the risk of breaking compatibility. This patch adds libxml2
> as extra (optional) dependency, but that also requires parsing the input
> twice.
> 
> If the protocol fails validation a warning is printed but no error is returned
> otherwise.
> 
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
> Changes to v1:
> - move the dtddata.S to SOURCES and add AM_PROG_AS to configure. This fixes
>   distcheck
> - handle explicit input files, rather than just stdin
> - changed the warning to refer to a built-in dtd 
> 
>  Makefile.am   | 11 ++++++---
>  configure.ac  | 13 +++++++++++
>  src/dtddata.S | 40 +++++++++++++++++++++++++++++++++
>  src/scanner.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 132 insertions(+), 3 deletions(-)
>  create mode 100644 src/dtddata.S

Hi Peter,

this patch R-b me, and so the whole 4-patch series pushed:
   c7bada0..f66e2d5  master -> master

This causes some noise in Weston as there are some protocols with
unexpected order of XML elements, but those are trivial to fix.
xdg-shell.xml uses some doc text that is not according to the DTD and
I'm not sure the scanner picks it up either, that will need a bit more.
It's about per-entry docs in enums.

I think I'll just push the desktop-shell.xml fix soon to Weston. Hmm,
or maybe after Jason's wayland-protocol migration series, as it renames
desktop-shell.xml.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/wayland-devel/attachments/20151117/f00fe5d9/attachment.sig>


More information about the wayland-devel mailing list