[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

On Tue, Oct 23, 2012 at 09:59:42AM -0600, Eric Blake wrote:
> 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.

Or use CDATA eg

  <!--  <![CDATA

    ....any text

  ]]> -->

Of course you still arguably need to escape any occurance of ']]>' in
the domain name, but that is not really likely compared to '--'

|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]