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

Eric Blake eblake at redhat.com
Tue Sep 28 19:19:42 UTC 2010


On 09/27/2010 02:26 PM, Stefan Berger wrote:
>>> 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.

Tab seems like it would be most likely for people to want, but I'm okay 
with leaving it unsupported for now until someone complains (and even 
then, it depends on whether XML parsing can even preserve tabs).

Patch 1 #defines MAX_COMMENT_LENGTH 256 in nwfilter_conf.c, patch 2 
#defines IPTABLES_MAX_COMMENT_SIZE  256 MAX_COMMENT_LENGTH 256 in 
nwfilter_ebiptables_driver.h.  Should these two values be consolidated 
into a single name in a common .h file in patch 1?

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvir-list mailing list