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

Re: [libvirt] [PATCHv2] schema: Relax schema for domain name



On 01/25/2012 08:49 AM, Peter Krempa wrote:
> The domain schema enforced restrictions on the domain name string that
> the code doesn't. This patch relaxes the check, leaving the restrictions
> on the driver or hypervisor. The only invalid character is a newline.
> ---
>  docs/schemas/domaincommon.rng |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
> index 4fa968d..ecf3484 100644
> --- a/docs/schemas/domaincommon.rng
> +++ b/docs/schemas/domaincommon.rng
> @@ -3030,7 +3030,7 @@
>    </define>
>    <define name="domainName">
>      <data type="string">
> -      <param name="pattern">[A-Za-z0-9_\.\+\-&amp;:/]+</param>
> +      <param name="pattern">[^\n]+</param>

Phooey.  This patch is causing a test failure on RHEL 6.2.  Apparently,
the version of libxml2-2.7.6-4.el6_2.1.x86_64 is treating that as a
regular expression that forbids literal 'n'; whereas on Fedora 16,
libxml2-2.7.8-6.fc16.x86_64 treats it as forbidding newline.

Interestingly enough, using a literal newline made the test patch in
both platforms.  I'm checking this in under the build-breaker rule, and
we'll need the same hack when we check in the XML for <title>:

From c3c2cc653408dd51f2f87371dfb0b00f7181fc00 Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake redhat com>
Date: Tue, 31 Jan 2012 16:51:36 -0700
Subject: [PATCH] build: fix text regression

Commit 8a09ee410 tickles a bug in libxml2-2.7.6 on RHEL 6.2,
where libxml2 treats the pattern [^\n] as excluding literal
backslash and n, instead of the intended newline, thus failing
to validate any domain name containing 'n'.

* docs/schemas/domaincommon.rng: Use literal newline instead.
---
 docs/schemas/domaincommon.rng |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 66e5491..2423154 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3058,7 +3058,9 @@
   </define>
   <define name="domainName">
     <data type="string">
-      <param name="pattern">[^\n]+</param>
+      <!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
+      <param name="pattern">[^
+]+</param>
     </data>
   </define>
   <define name="diskSerial">
-- 
1.7.7.6

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

Attachment: signature.asc
Description: OpenPGP digital signature


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