From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgHrF-0005Cx-9B for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:11:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YgHrA-00015u-AF for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:11:21 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:35530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YgHrA-00015a-2z for qemu-devel@nongnu.org; Thu, 09 Apr 2015 15:11:16 -0400 Received: by widdi4 with SMTP id di4so103705245wid.0 for ; Thu, 09 Apr 2015 12:11:15 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <5526CED0.9050503@redhat.com> Date: Thu, 09 Apr 2015 21:11:12 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1428516988-6760-1-git-send-email-ehabkost@redhat.com> <55266C5F.9040102@redhat.com> <20150409185059.GC18590@thinpad.lan.raisama.net> In-Reply-To: <20150409185059.GC18590@thinpad.lan.raisama.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] qemu-config: Accept empty option values List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: qemu-devel@nongnu.org, Gerd Hoffmann On 09/04/2015 20:50, Eduardo Habkost wrote: > On Thu, Apr 09, 2015 at 02:11:11PM +0200, Paolo Bonzini wrote: >> On 08/04/2015 20:16, Eduardo Habkost wrote: >>> Currently it is impossible to set an option in a config file to an empty >>> string, because the parser matches only lines containing non-empty >>> strings between double-quotes. >>> >>> As sscanf() "[" conversion specifier only matches non-empty strings, add >>> a special case for empty strings. >>> >>> Signed-off-by: Eduardo Habkost >>> --- >>> util/qemu-config.c | 3 ++- >>> 1 file changed, 2 insertions(+), 1 deletion(-) >>> >>> diff --git a/util/qemu-config.c b/util/qemu-config.c >>> index 2d32ce7..9f9577d 100644 >>> --- a/util/qemu-config.c >>> +++ b/util/qemu-config.c >>> @@ -413,7 +413,8 @@ int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) >>> opts = qemu_opts_create(list, NULL, 0, &error_abort); >>> continue; >>> } >>> - if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2) { >>> + if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 || >>> + (value[0] = '\0', sscanf(line, " %63s = \"\"", arg) == 1)) { >>> /* arg = value */ >>> if (opts == NULL) { >>> error_report("no group defined"); >>> >> >> Acked-by: Paolo Bonzini > > Thanks! Whose tree this should go through? Acked-by generally means that you're welcome to take it through yours. My "misc" tree hosts non-trivial patches outside well-defined maintainership area, but it's less work to carry patches only from people who don't send pull requests. Maybe it's not the case of this patch, but using your own tree also means that it's simpler for you to sort out the dependencies. Paolo