[libvirt] [PATCH] Strip control codes in virBufferEscapeString

Cole Robinson crobinso at redhat.com
Mon Mar 30 17:10:34 UTC 2015


On 03/30/2015 12:56 PM, Eric Blake wrote:
> On 03/30/2015 09:50 AM, Daniel Veillard wrote:
> 
>>> NACK.  Stripping control codes from a volume name represents the wrong
>>> name.  We need to escape the problematic bytes, rather than strip them.
>>
>>   you can't escape them with a CharRef for sure
>>
>> http://www.w3.org/TR/REC-xml/#wf-Legalchar
>> Characters referred to using character references must match the
>> production for Char.
>>
>>   That time Ján  is right :-)
> 
> Ouch.  Then how do we represent the name of a storage volume, when the
> file system allows arbitrary bytes including control characters, in the
> volume name, but where we are restricted to only using valid XML?  Do we
> just silently ignore such files as impossible volumes that libvirt
> cannot manage?  (I'd rather omit such a volume from the list in the
> pool, than silently munge its name into something incorrect)

I'd say just make a follow up patch/bz to reject unrepresentable filenames
before they hit the XML. It's a much less serious problem IMO

- Cole






More information about the libvir-list mailing list