[libvirt] [PATCH] xml: omit domain name from comment if it contains double hyphen

Eric Blake eblake at redhat.com
Tue Oct 23 15:59:42 UTC 2012


On 10/23/2012 09:31 AM, Daniel P. Berrange wrote:
> On Tue, Oct 23, 2012 at 02:16:44PM +0200, Ján Tomko wrote:
>> We put a comment containing "virsh edit <domain_name>" at the start of
>> the XML. W3C recommendation forbids the use of "--" in comments [1] and
>> libvirt can't parse it either. This patch omits the domain name if it
>> contains a double hyphen.
> 
> I'd really rather that we properly escaped the data rather than
> just dropping it.

Since the whole point of that comment is intended to give the user
something they can paste into their shell, we could just escape it by
doing: s/--/-''-/.  And for that to work, we'd also need to shell-escape
any other metacharacters in the domain name, so that the entire line is
something that can easily be copied and pasted.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121023/ccb409a8/attachment-0001.sig>


More information about the libvir-list mailing list