[libvirt] [PATCH v2 1/5] Extend XML parser and generator to support comment attribute

Stefan Berger stefanb at us.ibm.com
Mon Sep 27 20:26:54 UTC 2010


Eric Blake <eblake at redhat.com> wrote on 09/27/2010 04:02:54 PM:


> 
> On 09/27/2010 12:40 PM, Stefan Berger wrote:
> > V2:
> >   - introducing a field 'maxstrlen' to control the length of accepted 
string
> >   - removed function validating comment string assuming the XML parser
> >     already sinity checked the string
> 

> > The patch below extends the XML parser and generator so that every 
protocol
> > now can have a comment node. Comments are limited to 256 characters 
and are
> > tested to only contain printable characters or spaces.
> 
> Literal spaces, or generic blanks (space and tab for sure, but what 
> about newline, not to mention vertical tab, form feed, ...), all of 
> which are technically printable according to c_isprint()?

I have been doing some testing using 'virsh nwfilter-edit'. I edited a 
comment and put horizontal tabs into it or newlines or a combination of 
both. Both of these seem to automatically be converted to space,  meaning 
that when the XML is generated after the parsing, the tab or newline now 
are shown as simple space. I also wrote the XML into a file using 'virsh 
nwfilter-dumpxml', added a newline in the comment, ran unix2dos on it to 
get '\r' and used 'virsh nwfilter-define' on it again, and the '\r' 
disappeared. From that I took that the XML parser does the correct 
replacement already and I don't need to worry about it  -- assuming it 
would do the same for vertical tab as well.

   Stefan

> 
> -- 
> Eric Blake   eblake at redhat.com    +1-801-349-2682
> Libvirt virtualization library http://libvirt.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100927/936dccee/attachment-0001.htm>


More information about the libvir-list mailing list