Finally have some time to submit this small patch for a bug I'm seeing with Xen 3.3.1. If s-expression returned by xend contains an empty list, sexpr2string() failed to serialize it. E.g. sexpr containing (cpus (()())) would cause sexpr2string() to fail. I spoke with danpb on IRC about this bug and he suggested adding a XML/sexpr pair that exhibits the problem to tests/xml2sexprtest.c. I can easily produce the sexpr but not the case with XML. The empty cpus lists indicate no explicit affinity and AFAIK the only way to express this in XML is absence of cpuset attribute in vcpu element. But IMO we should not produce the (cpus (()()...)) sexpr in this case. It should only be produced when user has explicitly specified affinity. Does this sound reasonable? Regards, Jim
>From 1a1f8b9dbb68bf43c831e471ab4308d81a113ecd Mon Sep 17 00:00:00 2001 From: Jim Fehlig <jfehlig@xxxxxxxxxx> Date: Tue, 25 Aug 2009 15:54:18 -0600 Subject: [PATCH] Fix sexpr2string() to handle empty list. S-expression containing empty lists, e.g. (cpus (() () () ())), was not being handled properly in sexpr2string() serialization. Emit an empty list when encountering NIL sexpr kind. --- src/sexpr.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/sexpr.c b/src/sexpr.c index bc82d1f..81cb49f 100644 --- a/src/sexpr.c +++ b/src/sexpr.c @@ -255,6 +255,10 @@ sexpr2string(const struct sexpr * sexpr, char *buffer, size_t n_buffer) ret += tmp; break; case SEXPR_NIL: + tmp = snprintf(buffer + ret, n_buffer - ret, "()"); + if (tmp == 0) + goto error; + ret += tmp; break; default: goto error; -- 1.6.0.2
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list